diff --git a/boa/src/context.rs b/boa/src/context.rs index cb2b6abf9f..aa7b64ddbc 100644 --- a/boa/src/context.rs +++ b/boa/src/context.rs @@ -492,7 +492,7 @@ impl Context { let result = match Self::parser_expr(src) { Ok(expr) => expr.run(self), - Err(e) => self.throw_type_error(e), + Err(e) => self.throw_syntax_error(e), }; // The main_timer needs to be dropped before the BoaProfiler is. diff --git a/boa/src/exec/tests.rs b/boa/src/exec/tests.rs index 4927b74ef2..7ffd08e366 100644 --- a/boa/src/exec/tests.rs +++ b/boa/src/exec/tests.rs @@ -1377,3 +1377,9 @@ fn test_conditional_op() { let scenario = "1 === 2 ? 'a' : 'b'"; assert_eq!(&exec(scenario), "\"b\""); } + +#[test] +fn test_identifier_op() { + let scenario = "break = 1"; + assert_eq!(&exec(scenario), "\"SyntaxError\": \"expected token \'identifier\', got \'=\' in binding identifier at line 1, col 7\""); +}