keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-rest-id-exhausted.case |
| 3 | // - src/dstr-binding/default/var-stmt.template |
| 4 | /*--- |
| 5 | description: RestElement applied to an exhausted iterator (`var` statement) |
| 6 | esid: sec-variable-statement-runtime-semantics-evaluation |
| 7 | es6id: 13.3.2.4 |
| 8 | features: [Symbol.iterator, destructuring-binding] |
| 9 | flags: [generated] |
| 10 | info: | |
| 11 | VariableDeclaration : BindingPattern Initializer |
| 12 | |
| 13 | 1. Let rhs be the result of evaluating Initializer. |
| 14 | 2. Let rval be GetValue(rhs). |
| 15 | 3. ReturnIfAbrupt(rval). |
| 16 | 4. Return the result of performing BindingInitialization for |
| 17 | BindingPattern passing rval and undefined as arguments. |
| 18 | |
| 19 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 20 | BindingRestElement : ... BindingIdentifier |
| 21 | 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, |
| 22 | environment). |
| 23 | 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, |
| 24 | [...] |
| 25 | b. If iteratorRecord.[[done]] is true, then |
| 26 | i. If environment is undefined, return PutValue(lhs, A). |
| 27 | ii. Return InitializeReferencedBinding(lhs, A). |
| 28 | |
| 29 | ---*/ |
| 30 | |
| 31 | var [, , ...x] = [1, 2]; |
| 32 | |
| 33 | assert(Array.isArray(x)); |
| 34 | assert.sameValue(x.length, 0); |