eval-var-scope-syntax-err.js (1242B)
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-decl.template 4 /*--- 5 description: sloppy direct eval in params introduces var (async generator function declaration in sloppy code) 6 esid: sec-asyncgenerator-definitions-instantiatefunctionobject 7 features: [default-parameters, async-iteration] 8 flags: [generated, noStrict] 9 info: | 10 AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier 11 ( FormalParameters ) { AsyncGeneratorBody } 12 13 [...] 14 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, 15 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 async function* f(a = eval("var a = 42")) { 30 31 callCount = callCount + 1; 32 } 33 34 assert.throws(SyntaxError, function() { 35 f(); 36 }); 37 38 assert.sameValue(callCount, 0, 'generator function body not evaluated'); 39 40 reportCompare(0, 0);