Skip to content

Commit

Permalink
fix(parse): permit unbraced function expression as for's next
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Jun 8, 2023
1 parent e5d3d2a commit 6ac6dca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -3670,9 +3670,10 @@ class parser
&& curr().type() != lexeme::LeftParen // not imediatelly called
&& curr().type() != lexeme::RightParen // not as a last argument to function
&& curr().type() != lexeme::Comma // not as first or in-the-middle, function argument
&& curr().type() != lexeme::RightBracket // as the last index argument
&& curr().as_string_view() == "is" // as the argument to is
&& curr().as_string_view() == "as" // as the argument to as
&& curr().type() != lexeme::RightBracket // not as the last index argument
&& curr() != "is" // not as the argument to is
&& curr() != "as" // not as the argument to as
&& curr() != "do" // not as `for`'s `next`.
) {
// this is a fix for a short function syntax that should have double semicolon used
// (check comment in expression_statement(bool semicolon_required))
Expand Down

0 comments on commit 6ac6dca

Please sign in to comment.