Skip to content

Commit 3e1b064

Browse files
authored
Add finishNode when parsing malformed property declaration (#182)
1 parent 60a5f1a commit 3e1b064

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/parser/parser.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ func (p *Parser) parseClassElement() *ast.Node {
14611461
if modifiers != nil {
14621462
// treat this as a property declaration with a missing name.
14631463
p.parseErrorAt(p.nodePos(), p.nodePos(), diagnostics.Declaration_expected)
1464-
name := p.newIdentifier("")
1464+
name := p.createMissingIdentifier()
14651465
return p.parsePropertyDeclaration(pos, hasJSDoc, modifiers, name, nil /*questionToken*/)
14661466
}
14671467
// 'isClassMemberStart' should have hinted not to attempt parsing.
@@ -5418,9 +5418,7 @@ func (p *Parser) createIdentifierWithDiagnostic(isIdentifier bool, diagnosticMes
54185418
} else {
54195419
p.parseErrorAtCurrentToken(diagnostics.Identifier_expected)
54205420
}
5421-
result := p.newIdentifier("")
5422-
p.finishNode(result, p.nodePos())
5423-
return result
5421+
return p.createMissingIdentifier()
54245422
}
54255423

54265424
func (p *Parser) internIdentifier(text string) {

0 commit comments

Comments
 (0)