| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/function-forms/dflt-params-trailing-comma.case |
| 3 |
// - src/function-forms/default/gen-meth.template |
| 4 |
/*--- |
| 5 |
description: A trailing comma should not increase the respective length, using default parameters (generator method) |
| 6 |
esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation |
| 7 |
features: [generators] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
GeneratorMethod : |
| 11 |
* PropertyName ( StrictFormalParameters ) { GeneratorBody } |
| 12 |
|
| 13 |
1. Let propKey be the result of evaluating PropertyName. |
| 14 |
2. ReturnIfAbrupt(propKey). |
| 15 |
3. If the function code for this GeneratorMethod is strict mode code, |
| 16 |
let strict be true. Otherwise let strict be false. |
| 17 |
4. Let scope be the running execution context's LexicalEnvironment. |
| 18 |
5. Let closure be GeneratorFunctionCreate(Method, |
| 19 |
StrictFormalParameters, GeneratorBody, scope, strict). |
| 20 |
[...] |
| 21 |
|
| 22 |
9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 23 |
|
| 24 |
[...] |
| 25 |
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 26 |
[...] |
| 27 |
|
| 28 |
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 29 |
|
| 30 |
1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 31 |
[...] |
| 32 |
|
| 33 |
9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 34 |
|
| 35 |
[...] |
| 36 |
23. Let iteratorRecord be Record {[[iterator]]: |
| 37 |
CreateListIterator(argumentsList), [[done]]: false}. |
| 38 |
24. If hasDuplicates is true, then |
| 39 |
[...] |
| 40 |
25. Else, |
| 41 |
b. Let formalStatus be IteratorBindingInitialization for formals with |
| 42 |
iteratorRecord and env as arguments. |
| 43 |
[...] |
| 44 |
|
| 45 |
|
| 46 |
Trailing comma in the parameters list |
| 47 |
|
| 48 |
14.1 Function Definitions |
| 49 |
|
| 50 |
FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , |
| 51 |
---*/ |
| 52 |
|
| 53 |
var callCount = 0; |
| 54 |
var obj = { |
| 55 |
*method(a, b = 39,) { |
| 56 |
assert.sameValue(a, 42); |
| 57 |
assert.sameValue(b, 39); |
| 58 |
callCount = callCount + 1; |
| 59 |
} |
| 60 |
}; |
| 61 |
|
| 62 |
obj.method(42, undefined, 1).next(); |
| 63 |
|
| 64 |
// Stores a reference `ref` for case evaluation |
| 65 |
var ref = obj.method; |
| 66 |
|
| 67 |
assert.sameValue(callCount, 1, 'generator method invoked exactly once'); |
| 68 |
|
| 69 |
assert.sameValue(ref.length, 1, 'length is properly set'); |