| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/function-forms/params-trailing-comma-single.case |
| 3 |
// - src/function-forms/default/cls-expr-async-meth.template |
| 4 |
/*--- |
| 5 |
description: A trailing comma should not increase the respective length, using a single parameter (class expression async method) |
| 6 |
esid: sec-class-definitions-runtime-semantics-evaluation |
| 7 |
flags: [generated, async] |
| 8 |
info: | |
| 9 |
ClassExpression : class BindingIdentifieropt ClassTail |
| 10 |
|
| 11 |
1. If BindingIdentifieropt is not present, let className be undefined. |
| 12 |
2. Else, let className be StringValue of BindingIdentifier. |
| 13 |
3. Let value be the result of ClassDefinitionEvaluation of ClassTail |
| 14 |
with 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 |
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } |
| 29 |
|
| 30 |
1. Let propKey be the result of evaluating PropertyName. |
| 31 |
2. ReturnIfAbrupt(propKey). |
| 32 |
3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise |
| 33 |
let strict be false. |
| 34 |
4. Let scope be the LexicalEnvironment of the running execution context. |
| 35 |
5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, |
| 36 |
scope, strict). |
| 37 |
[...] |
| 38 |
|
| 39 |
|
| 40 |
Trailing comma in the parameters list |
| 41 |
|
| 42 |
14.1 Function Definitions |
| 43 |
|
| 44 |
FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , |
| 45 |
---*/ |
| 46 |
|
| 47 |
var callCount = 0; |
| 48 |
var C = class { |
| 49 |
async method(a,) { |
| 50 |
assert.sameValue(a, 42); |
| 51 |
callCount = callCount + 1; |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
// Stores a reference `ref` for case evaluation |
| 56 |
var ref = C.prototype.method; |
| 57 |
|
| 58 |
ref(42, 39).then(() => { |
| 59 |
assert.sameValue(callCount, 1, 'method invoked exactly once'); |
| 60 |
}).then($DONE, $DONE); |
| 61 |
|
| 62 |
assert.sameValue(ref.length, 1, 'length is properly set'); |