Debian Codegraph @

js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/function-forms/dflt-params-ref-self.case
4 // - src/function-forms/error/async-meth.template
5 /*---
6 description: Referencing a parameter from within its own initializer (async method)
7 esid: sec-async-function-definitions
8 features: [default-parameters, async-functions]
9 flags: [generated, async]
10 info: |
11 14.6 Async Function Definitions
12
13 AsyncMethod :
14 async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
15
16
17 14.1.19 Runtime Semantics: IteratorBindingInitialization
18
19 FormalsList : FormalsList , FormalParameter
20
21 1. Let status be the result of performing IteratorBindingInitialization for
22 FormalsList using iteratorRecord and environment as the arguments.
23 2. ReturnIfAbrupt(status).
24 3. Return the result of performing IteratorBindingInitialization for
25 FormalParameter using iteratorRecord and environment as the arguments.
26
27 ---*/
28 var x = 0;
29
30
31 var callCount = 0;
32
33 var obj = {
34 async method(x = x) {
35
36 callCount = callCount + 1;
37 }
38 };
39
40 obj.method()
41 .then(_ => {
42 throw new Test262Error('function should not be resolved');
43 }, error => assert.sameValue(error.constructor, ReferenceError))
44 .then(() => {
45 assert.sameValue(callCount, 0, 'function body is not evaluated');
46 }, $DONE)
47 .then($DONE, $DONE);