Debian Codegraph @

js/src/tests/test262/language/expressions/object/method-definition/async-meth-eval-var-scope-syntax-err.js

raw
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-meth.template
5 /*---
6 description: sloppy direct eval in params introduces var (async method 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 AsyncMethod :
14 async PropertyName ( UniqueFormalParameters ) { 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
28 var obj = {
29 async method(a = eval("var a = 42")) {
30
31 callCount = callCount + 1;
32 }
33 };
34
35 obj.method()
36 .then(_ => {
37 throw new Test262Error('function should not be resolved');
38 }, error => assert.sameValue(error.constructor, SyntaxError))
39 .then(() => {
40 assert.sameValue(callCount, 0, 'function body is not evaluated');
41 }, $DONE)
42 .then($DONE, $DONE);