From 93b52cd6ef1ff2c646dd3afe3b5eb6881a35679e Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Sat, 22 Apr 2023 19:17:51 +0000 Subject: [PATCH] Catch 'eval' and 'arguments' in setter method parameter (#2858) This Pull Request changes the following: - Catch 'eval' and 'arguments' in setter method parameter --- .../parser/expression/primary/object_initializer/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boa_parser/src/parser/expression/primary/object_initializer/mod.rs b/boa_parser/src/parser/expression/primary/object_initializer/mod.rs index ef63c74f93..a717e364e0 100644 --- a/boa_parser/src/parser/expression/primary/object_initializer/mod.rs +++ b/boa_parser/src/parser/expression/primary/object_initializer/mod.rs @@ -418,6 +418,14 @@ where interner, )?; + // Catch early error for BindingIdentifier. + if body.strict() && contains(¶meters, ContainsSymbol::EvalOrArguments) { + return Err(Error::lex(LexError::Syntax( + "unexpected identifier 'eval' or 'arguments' in strict mode".into(), + params_start_position, + ))); + } + // It is a Syntax Error if FunctionBodyContainsUseStrict of FunctionBody is true // and IsSimpleParameterList of PropertySetParameterList is false. // https://tc39.es/ecma262/#sec-method-definitions-static-semantics-early-errors