| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/arguments/args-trailing-comma-undefined.case |
| 3 |
// - src/arguments/default/async-gen-named-func-expr.template |
| 4 |
/*--- |
| 5 |
description: A trailing comma after undefined should not increase the arguments.length (async generator named function expression) |
| 6 |
esid: sec-asyncgenerator-definitions-evaluation |
| 7 |
features: [async-iteration] |
| 8 |
flags: [generated, async] |
| 9 |
info: | |
| 10 |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier |
| 11 |
( FormalParameters ) { AsyncGeneratorBody } |
| 12 |
|
| 13 |
[...] |
| 14 |
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, |
| 15 |
AsyncGeneratorBody, funcEnv, strict). |
| 16 |
[...] |
| 17 |
|
| 18 |
|
| 19 |
Trailing comma in the arguments list |
| 20 |
|
| 21 |
12.3 Left-Hand-Side Expressions |
| 22 |
|
| 23 |
Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) |
| 24 |
---*/ |
| 25 |
|
| 26 |
|
| 27 |
var callCount = 0; |
| 28 |
// Stores a reference `ref` for case evaluation |
| 29 |
var ref; |
| 30 |
ref = async function* g() { |
| 31 |
assert.sameValue(arguments.length, 2); |
| 32 |
assert.sameValue(arguments[0], 42); |
| 33 |
assert.sameValue(arguments[1], undefined); |
| 34 |
callCount = callCount + 1; |
| 35 |
}; |
| 36 |
|
| 37 |
ref(42, undefined,).next().then(() => { |
| 38 |
assert.sameValue(callCount, 1, 'generator function invoked exactly once'); |
| 39 |
}).then($DONE, $DONE); |