Debian Codegraph @

js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-ref-later.case
3 // - src/function-forms/error/cls-decl-async-gen-meth.template
4 /*---
5 description: Referencing a parameter that occurs later in the ParameterList (class expression method)
6 esid: sec-class-definitions-runtime-semantics-evaluation
7 features: [default-parameters, async-iteration]
8 flags: [generated]
9 info: |
10 ClassDeclaration : class BindingIdentifier ClassTail
11
12 1. Let className be StringValue of BindingIdentifier.
13 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
14 argument className.
15 [...]
16
17 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
18
19 21. For each ClassElement m in order from methods
20 a. If IsStatic of m is false, then
21 i. Let status be the result of performing
22 PropertyDefinitionEvaluation for m with arguments proto and
23 false.
24 [...]
25
26 Runtime Semantics: PropertyDefinitionEvaluation
27
28 AsyncGeneratorMethod :
29 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
30 { AsyncGeneratorBody }
31
32 1. Let propKey be the result of evaluating PropertyName.
33 2. ReturnIfAbrupt(propKey).
34 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
35 Otherwise let strict be false.
36 4. Let scope be the running execution context's LexicalEnvironment.
37 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
38 AsyncGeneratorBody, 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 var callCount = 0;
56 class C {
57 async *method(x = y, y) {
58
59 callCount = callCount + 1;
60 }
61 }
62
63 assert.throws(ReferenceError, function() {
64 C.prototype.method();
65 });
66 assert.sameValue(callCount, 0, 'method body not evaluated');
67
68 reportCompare(0, 0);