diff --git a/boa/src/exec/tests.rs b/boa/src/exec/tests.rs index 246fbe6c59a..2e3f3211dcd 100644 --- a/boa/src/exec/tests.rs +++ b/boa/src/exec/tests.rs @@ -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); } diff --git a/boa/src/syntax/parser/statement/mod.rs b/boa/src/syntax/parser/statement/mod.rs index 95ed6feae72..08b419f4d11 100644 --- a/boa/src/syntax/parser/statement/mod.rs +++ b/boa/src/syntax/parser/statement/mod.rs @@ -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() @@ -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), } } }