(allowExclamation bool)
| 1614 | } |
| 1615 | |
| 1616 | func (p *Parser) parseVariableDeclarationWorker(allowExclamation bool) *ast.Node { |
| 1617 | pos := p.nodePos() |
| 1618 | jsdoc := p.jsdocScannerInfo() |
| 1619 | name := p.parseIdentifierOrPatternWithDiagnostic(diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations) |
| 1620 | var exclamationToken *ast.Node |
| 1621 | if allowExclamation && name.Kind == ast.KindIdentifier && p.token == ast.KindExclamationToken && !p.hasPrecedingLineBreak() { |
| 1622 | exclamationToken = p.parseTokenNode() |
| 1623 | } |
| 1624 | typeNode := p.parseTypeAnnotation() |
| 1625 | var initializer *ast.Expression |
| 1626 | if p.token != ast.KindInKeyword && p.token != ast.KindOfKeyword { |
| 1627 | initializer = p.parseInitializer() |
| 1628 | } |
| 1629 | result := p.finishNode(p.factory.NewVariableDeclaration(name, exclamationToken, typeNode, initializer), pos) |
| 1630 | p.withJSDoc(result, jsdoc) |
| 1631 | p.checkJSSyntax(result) |
| 1632 | return result |
| 1633 | } |
| 1634 | |
| 1635 | func (p *Parser) parseIdentifierOrPattern() *ast.Node { |
| 1636 | return p.parseIdentifierOrPatternWithDiagnostic(nil) |
no test coverage detected