()
| 1518 | } |
| 1519 | |
| 1520 | func (p *Parser) parseExpressionOrLabeledStatement() *ast.Statement { |
| 1521 | // Avoiding having to do the lookahead for a labeled statement by just trying to parse |
| 1522 | // out an expression, seeing if it is identifier and then seeing if it is followed by |
| 1523 | // a colon. |
| 1524 | pos := p.nodePos() |
| 1525 | jsdoc := p.jsdocScannerInfo() |
| 1526 | hasParen := p.token == ast.KindOpenParenToken |
| 1527 | expression := p.parseExpression() |
| 1528 | |
| 1529 | if expression.Kind == ast.KindIdentifier && p.parseOptional(ast.KindColonToken) { |
| 1530 | result := p.finishNode(p.factory.NewLabeledStatement(expression, p.parseStatement()), pos) |
| 1531 | p.withJSDoc(result, jsdoc) |
| 1532 | return result |
| 1533 | } |
| 1534 | |
| 1535 | if !p.tryParseSemicolon() { |
| 1536 | p.parseErrorForMissingSemicolonAfter(expression) |
| 1537 | } |
| 1538 | result := p.finishNode(p.factory.NewExpressionStatement(expression), pos) |
| 1539 | if hasParen { |
| 1540 | jsdoc &^= jsdocScannerInfoHasJSDoc |
| 1541 | } |
| 1542 | p.withJSDoc(result, jsdoc) |
| 1543 | return result |
| 1544 | } |
| 1545 | |
| 1546 | func (p *Parser) parseVariableStatement(pos int, jsdoc jsdocScannerInfo, modifiers *ast.ModifierList) *ast.Node { |
| 1547 | declarationList := p.parseVariableDeclarationList(false /*inForStatementInitializer*/) |
no test coverage detected