dflt-params-trailing-comma.js (2158B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/dflt-params-trailing-comma.case 4 // - src/function-forms/default/cls-decl-async-meth-static.template 5 /*--- 6 description: A trailing comma should not increase the respective length, using default parameters (static class declaration async method) 7 esid: sec-runtime-semantics-bindingclassdeclarationevaluation 8 features: [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 Trailing comma in the parameters list 42 43 14.1 Function Definitions 44 45 FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , 46 ---*/ 47 48 49 var callCount = 0; 50 class C { 51 static async method(a, b = 39,) { 52 assert.sameValue(a, 42); 53 assert.sameValue(b, 39); 54 callCount = callCount + 1; 55 } 56 } 57 58 // Stores a reference `ref` for case evaluation 59 var ref = C.method; 60 61 ref(42, undefined, 1).then(() => { 62 assert.sameValue(callCount, 1, 'method invoked exactly once'); 63 }).then($DONE, $DONE); 64 65 assert.sameValue(ref.length, 1, 'length is properly set');