tor-browser

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

eval-var-scope-syntax-err.js (1221B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/function-forms/eval-var-scope-syntax-err.case
      3 // - src/function-forms/error-no-strict/async-gen-func-expr.template
      4 /*---
      5 description: sloppy direct eval in params introduces var (async generator function expression in sloppy code)
      6 esid: sec-asyncgenerator-definitions-evaluation
      7 features: [default-parameters, async-iteration]
      8 flags: [generated, noStrict]
      9 info: |
     10    AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
     11        AsyncGeneratorBody }
     12 
     13        [...]
     14        3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
     15           AsyncGeneratorBody, scope, strict).
     16        [...]
     17 
     18 
     19    
     20    Runtime Semantics: IteratorBindingInitialization
     21    FormalParameter : BindingElement
     22 
     23    1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
     24 
     25 ---*/
     26 
     27 
     28 var callCount = 0;
     29 var f;
     30 f = async function*(a = eval("var a = 42")) {
     31  
     32  callCount = callCount + 1;
     33 };
     34 
     35 assert.throws(SyntaxError, function() {
     36  f();
     37 });
     38 assert.sameValue(callCount, 0, 'generator function body not evaluated');
     39 
     40 reportCompare(0, 0);