direct-eval-err-contains-arguments.js (1202B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/eval-err-contains-arguments.case 3 // - src/class-elements/initializer-direct-eval-arguments/cls-decl-fields-eval.template 4 /*--- 5 description: error if `arguments` in StatementList of eval (direct eval) 6 esid: sec-performeval-rules-in-initializer 7 features: [class, class-fields-public] 8 flags: [generated] 9 info: | 10 Additional Early Error Rules for Eval Inside Initializer 11 These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer. 12 ScriptBody : StatementList 13 14 It is a Syntax Error if ContainsArguments of StatementList is true. 15 ... 16 17 Static Semantics: ContainsArguments 18 IdentifierReference : Identifier 19 20 1. If the StringValue of Identifier is "arguments", return true. 21 ... 22 For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. 23 24 ---*/ 25 26 27 var executed = false; 28 class C { 29 x = eval('executed = true; arguments;'); 30 } 31 32 assert.throws(SyntaxError, function() { 33 new C(); 34 }); 35 36 assert.sameValue(executed, false); 37 38 reportCompare(0, 0);