Skip to content

Commit

Permalink
moving into Identifier check
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams committed Sep 22, 2020
1 parent 9a98fab commit 1b70069
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion boa/src/exec/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ fn assign_to_object_decl() {
let mut engine = Context::new();

const ERR_MSG: &str =
"Uncaught \"SyntaxError\": \"expected token \';\', got \':\' in expression statement at line 1, col 3\"";
"Uncaught \"SyntaxError\": \"unexpected token '=', primary expression at line 1, col 8\"";

assert_eq!(forward(&mut engine, "{a: 3} = {a: 5};"), ERR_MSG);
}
Expand Down
6 changes: 4 additions & 2 deletions boa/src/syntax/parser/statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ where
.parse(cursor)
.map(Node::from)
}
_ => {
// Before falling to expression check for a label
TokenKind::Identifier(_) => {
// Labelled Statement check
cursor.set_goal(InputElement::Div);
let tok = cursor.peek(1)?;
if tok.is_some()
Expand All @@ -193,6 +193,8 @@ where

ExpressionStatement::new(self.allow_yield, self.allow_await).parse(cursor)
}

_ => ExpressionStatement::new(self.allow_yield, self.allow_await).parse(cursor),
}
}
}
Expand Down

0 comments on commit 1b70069

Please sign in to comment.