()
| 1448 | } |
| 1449 | |
| 1450 | func (p *Parser) parseThrowStatement() *ast.Node { |
| 1451 | // ThrowStatement[Yield] : |
| 1452 | // throw [no LineTerminator here]Expression[In, ?Yield]; |
| 1453 | pos := p.nodePos() |
| 1454 | jsdoc := p.jsdocScannerInfo() |
| 1455 | p.parseExpected(ast.KindThrowKeyword) |
| 1456 | // Because of automatic semicolon insertion, we need to report error if this |
| 1457 | // throw could be terminated with a semicolon. Note: we can't call 'parseExpression' |
| 1458 | // directly as that might consume an expression on the following line. |
| 1459 | // Instead, we create a "missing" identifier, but don't report an error. The actual error |
| 1460 | // will be reported in the grammar walker. |
| 1461 | var expression *ast.Expression |
| 1462 | if !p.hasPrecedingLineBreak() { |
| 1463 | expression = p.parseExpressionAllowIn() |
| 1464 | } else { |
| 1465 | expression = p.createMissingIdentifier() |
| 1466 | } |
| 1467 | if !p.tryParseSemicolon() { |
| 1468 | p.parseErrorForMissingSemicolonAfter(expression) |
| 1469 | } |
| 1470 | result := p.finishNode(p.factory.NewThrowStatement(expression), pos) |
| 1471 | p.withJSDoc(result, jsdoc) |
| 1472 | return result |
| 1473 | } |
| 1474 | |
| 1475 | // TODO: Review for error recovery |
| 1476 | func (p *Parser) parseTryStatement() *ast.Node { |
no test coverage detected