Skip to content

Commit 96cf605

Browse files
committed
fix(parse): permit unbraced function expression as for's next
1 parent 509ca7f commit 96cf605

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

source/parse.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,9 +5364,10 @@ class parser
53645364
&& curr().type() != lexeme::LeftParen // not imediatelly called
53655365
&& curr().type() != lexeme::RightParen // not as a last argument to function
53665366
&& curr().type() != lexeme::Comma // not as first or in-the-middle, function argument
5367-
&& curr().type() != lexeme::RightBracket // as the last index argument
5368-
&& curr().as_string_view() == "is" // as the argument to is
5369-
&& curr().as_string_view() == "as" // as the argument to as
5367+
&& curr().type() != lexeme::RightBracket // not as the last index argument
5368+
&& curr() != "is" // not as the argument to is
5369+
&& curr() != "as" // not as the argument to as
5370+
&& curr() != "do" // not as `for`'s `next`.
53705371
) {
53715372
// this is a fix for a short function syntax that should have double semicolon used
53725373
// (check comment in expression_statement(bool semicolon_required))

0 commit comments

Comments
 (0)