Skip to content

Commit b65a3ad

Browse files
Restore error recovery for semicolons following expression statements (microsoft#431)
1 parent 879d765 commit b65a3ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/parser/parser.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,17 +1350,17 @@ func (p *Parser) parseExpressionOrLabeledStatement() *ast.Statement {
13501350
hasJSDoc := p.hasPrecedingJSDocComment()
13511351
hasParen := p.token == ast.KindOpenParenToken
13521352
expression := p.parseExpression()
1353+
13531354
if expression.Kind == ast.KindIdentifier && p.parseOptional(ast.KindColonToken) {
13541355
result := p.factory.NewLabeledStatement(expression, p.parseStatement())
13551356
p.finishNode(result, pos)
13561357
p.withJSDoc(result, hasJSDoc)
13571358
return result
13581359
}
1359-
// !!!
1360-
// if !p.tryParseSemicolon() {
1361-
// p.parseErrorForMissingSemicolonAfter(expression)
1362-
// }
1363-
p.parseSemicolon()
1360+
1361+
if !p.tryParseSemicolon() {
1362+
p.parseErrorForMissingSemicolonAfter(expression)
1363+
}
13641364
result := p.factory.NewExpressionStatement(expression)
13651365
p.finishNode(result, pos)
13661366
p.withJSDoc(result, hasJSDoc && !hasParen)

0 commit comments

Comments
 (0)