Debian Codegraph @

js/src/tests/test262/language/expressions/async-generator/named-eval-var-scope-syntax-err.js

raw
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-named-func-expr.template
4 /*---
5 description: sloppy direct eval in params introduces var (async generator named 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 * BindingIdentifier
11 ( FormalParameters ) { AsyncGeneratorBody }
12
13 [...]
14 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
15 AsyncGeneratorBody, funcEnv, 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* g(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);