dflt-params-ref-prior.js (2492B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/dflt-params-ref-prior.case 4 // - src/function-forms/default/cls-decl-async-meth-static.template 5 /*--- 6 description: Referencing a parameter that occurs earlier in the ParameterList (static class declaration async method) 7 esid: sec-runtime-semantics-bindingclassdeclarationevaluation 8 features: [default-parameters, async-functions] 9 flags: [generated, async] 10 info: | 11 ClassDeclaration : class BindingIdentifier ClassTail 12 13 1. Let className be StringValue of BindingIdentifier. 14 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with 15 argument className. 16 [...] 17 18 14.5.14 Runtime Semantics: ClassDefinitionEvaluation 19 20 21. For each ClassElement m in order from methods 21 a. If IsStatic of m is false, then 22 b. Else, 23 Let status be the result of performing PropertyDefinitionEvaluation for 24 m with arguments F and false. 25 [...] 26 27 Runtime Semantics: PropertyDefinitionEvaluation 28 29 AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } 30 31 1. Let propKey be the result of evaluating PropertyName. 32 2. ReturnIfAbrupt(propKey). 33 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise 34 let strict be false. 35 4. Let scope be the LexicalEnvironment of the running execution context. 36 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, 37 scope, strict). 38 [...] 39 40 41 14.1.19 Runtime Semantics: IteratorBindingInitialization 42 43 FormalsList : FormalsList , FormalParameter 44 45 1. Let status be the result of performing IteratorBindingInitialization for 46 FormalsList using iteratorRecord and environment as the arguments. 47 2. ReturnIfAbrupt(status). 48 3. Return the result of performing IteratorBindingInitialization for 49 FormalParameter using iteratorRecord and environment as the arguments. 50 51 ---*/ 52 var x = 0; 53 54 55 var callCount = 0; 56 class C { 57 static async method(x, y = x, z = y) { 58 assert.sameValue(x, 3, 'first argument value'); 59 assert.sameValue(y, 3, 'second argument value'); 60 assert.sameValue(z, 3, 'third argument value'); 61 callCount = callCount + 1; 62 } 63 } 64 65 // Stores a reference `ref` for case evaluation 66 var ref = C.method; 67 68 ref(3).then(() => { 69 assert.sameValue(callCount, 1, 'method invoked exactly once'); 70 }).then($DONE, $DONE);