tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

arrow-body-private-direct-eval-err-contains-arguments.js (1287B)


      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-private-fields-eval-arrow-body.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, class-fields-private]
      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  constructor() {
     31    this.#x();
     32  }
     33 }
     34 
     35 assert.throws(SyntaxError, function() {
     36  new C();
     37 });
     38 
     39 assert.sameValue(executed, false);
     40 
     41 reportCompare(0, 0);