named-eval-var-scope-syntax-err.js (1217B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/eval-var-scope-syntax-err.case 4 // - src/function-forms/error-no-strict/async-func-expr-named.template 5 /*--- 6 description: sloppy direct eval in params introduces var (async function named expression in sloppy code) 7 esid: sec-async-function-definitions 8 features: [default-parameters, async-functions] 9 flags: [generated, async, noStrict] 10 info: | 11 14.6 Async Function Definitions 12 13 AsyncFunctionExpression : 14 async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } 15 16 17 18 Runtime Semantics: IteratorBindingInitialization 19 FormalParameter : BindingElement 20 21 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. 22 23 ---*/ 24 25 26 var callCount = 0; 27 var f = async function f(a = eval("var a = 42")) { 28 29 callCount = callCount + 1; 30 } 31 32 f() 33 .then(_ => { 34 throw new Test262Error('function should not be resolved'); 35 }, error => assert.sameValue(error.constructor, SyntaxError)) 36 .then(() => { 37 assert.sameValue(callCount, 0, 'function body is not evaluated'); 38 }, $DONE) 39 .then($DONE, $DONE);