Debian Codegraph @

js/src/tests/test262/language/expressions/class/async-method-static/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/cls-expr-async-meth-static.template
5 /*---
6 description: Referencing a parameter from within its own initializer (static class expression async method)
7 esid: sec-class-definitions-runtime-semantics-evaluation
8 features: [default-parameters, async-functions]
9 flags: [generated, async]
10 info: |
11 ClassExpression : class BindingIdentifieropt ClassTail
12
13 1. If BindingIdentifieropt is not present, let className be undefined.
14 2. Else, let className be StringValue of BindingIdentifier.
15 3. Let value be the result of ClassDefinitionEvaluation of ClassTail
16 with argument className.
17 [...]
18
19 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
20
21 21. For each ClassElement m in order from methods
22 a. If IsStatic of m is false, then
23 b. Else,
24 Let status be the result of performing PropertyDefinitionEvaluation
25 for m with arguments F and false.
26 [...]
27
28 Runtime Semantics: PropertyDefinitionEvaluation
29
30 AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
31
32 1. Let propKey be the result of evaluating PropertyName.
33 2. ReturnIfAbrupt(propKey).
34 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
35 let strict be false.
36 4. Let scope be the LexicalEnvironment of the running execution context.
37 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
38 scope, strict).
39 [...]
40
41
42 14.1.19 Runtime Semantics: IteratorBindingInitialization
43
44 FormalsList : FormalsList , FormalParameter
45
46 1. Let status be the result of performing IteratorBindingInitialization for
47 FormalsList using iteratorRecord and environment as the arguments.
48 2. ReturnIfAbrupt(status).
49 3. Return the result of performing IteratorBindingInitialization for
50 FormalParameter using iteratorRecord and environment as the arguments.
51
52 ---*/
53 var x = 0;
54
55
56 var callCount = 0;
57
58 var C = class {
59 static async method(x = x) {
60
61 callCount = callCount + 1;
62 }
63 };
64
65 C.method()
66 .then(_ => {
67 throw new Test262Error('function should not be resolved');
68 }, error => assert.sameValue(error.constructor, ReferenceError))
69 .then(() => {
70 assert.sameValue(callCount, 0, 'function body is not evaluated');
71 }, $DONE)
72 .then($DONE, $DONE);