| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/function-forms/dflt-params-trailing-comma.case |
| 3 |
// - src/function-forms/default/meth.template |
| 4 |
/*--- |
| 5 |
description: A trailing comma should not increase the respective length, using default parameters (method) |
| 6 |
esid: sec-runtime-semantics-definemethod |
| 7 |
flags: [generated] |
| 8 |
info: | |
| 9 |
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } |
| 10 |
|
| 11 |
[...] |
| 12 |
6. Let closure be FunctionCreate(kind, StrictFormalParameters, |
| 13 |
FunctionBody, scope, strict). If functionPrototype was passed as a |
| 14 |
parameter then pass its value as the functionPrototype optional argument |
| 15 |
of FunctionCreate. |
| 16 |
[...] |
| 17 |
|
| 18 |
9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 19 |
|
| 20 |
[...] |
| 21 |
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 22 |
[...] |
| 23 |
|
| 24 |
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 25 |
|
| 26 |
1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 27 |
[...] |
| 28 |
|
| 29 |
9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 30 |
|
| 31 |
[...] |
| 32 |
23. Let iteratorRecord be Record {[[iterator]]: |
| 33 |
CreateListIterator(argumentsList), [[done]]: false}. |
| 34 |
24. If hasDuplicates is true, then |
| 35 |
[...] |
| 36 |
25. Else, |
| 37 |
b. Let formalStatus be IteratorBindingInitialization for formals with |
| 38 |
iteratorRecord and env as arguments. |
| 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 |
var callCount = 0; |
| 49 |
var obj = { |
| 50 |
method(a, b = 39,) { |
| 51 |
assert.sameValue(a, 42); |
| 52 |
assert.sameValue(b, 39); |
| 53 |
callCount = callCount + 1; |
| 54 |
} |
| 55 |
}; |
| 56 |
|
| 57 |
obj.method(42, undefined, 1); |
| 58 |
|
| 59 |
// Stores a reference `ref` for case evaluation |
| 60 |
var ref = obj.method; |
| 61 |
|
| 62 |
assert.sameValue(callCount, 1, 'method invoked exactly once'); |
| 63 |
|
| 64 |
assert.sameValue(ref.length, 1, 'length is properly set'); |