| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/ary-ptrn-rest-init-ary.case |
| 3 |
// - src/dstr-binding/default/gen-func-expr.template |
| 4 |
/*--- |
| 5 |
description: Reset element (nested array pattern) does not support initializer (generator function expression) |
| 6 |
esid: sec-generator-function-definitions-runtime-semantics-evaluation |
| 7 |
es6id: 14.4.14 |
| 8 |
features: [generators, destructuring-binding] |
| 9 |
flags: [generated] |
| 10 |
negative: |
| 11 |
phase: parse |
| 12 |
type: SyntaxError |
| 13 |
info: | |
| 14 |
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } |
| 15 |
|
| 16 |
[...] |
| 17 |
3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, |
| 18 |
GeneratorBody, scope, strict). |
| 19 |
[...] |
| 20 |
|
| 21 |
9.2.1 [[Call]] ( thisArgument, argumentsList) |
| 22 |
|
| 23 |
[...] |
| 24 |
7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 25 |
[...] |
| 26 |
|
| 27 |
9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) |
| 28 |
|
| 29 |
1. Let status be FunctionDeclarationInstantiation(F, argumentsList). |
| 30 |
[...] |
| 31 |
|
| 32 |
9.2.12 FunctionDeclarationInstantiation(func, argumentsList) |
| 33 |
|
| 34 |
[...] |
| 35 |
23. Let iteratorRecord be Record {[[iterator]]: |
| 36 |
CreateListIterator(argumentsList), [[done]]: false}. |
| 37 |
24. If hasDuplicates is true, then |
| 38 |
[...] |
| 39 |
25. Else, |
| 40 |
b. Let formalStatus be IteratorBindingInitialization for formals with |
| 41 |
iteratorRecord and env as arguments. |
| 42 |
[...] |
| 43 |
|
| 44 |
13.3.3 Destructuring Binding Patterns |
| 45 |
ArrayBindingPattern[Yield] : |
| 46 |
[ Elisionopt BindingRestElement[?Yield]opt ] |
| 47 |
[ BindingElementList[?Yield] ] |
| 48 |
[ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] |
| 49 |
---*/ |
| 50 |
throw "Test262: This statement should not be evaluated."; |
| 51 |
|
| 52 |
var callCount = 0; |
| 53 |
var f; |
| 54 |
f = function*([...[ x ] = []]) { |
| 55 |
|
| 56 |
callCount = callCount + 1; |
| 57 |
}; |
| 58 |
|
| 59 |
f([]).next(); |
| 60 |
assert.sameValue(callCount, 1, 'generator function invoked exactly once'); |