blob: 0b4710f602a5626f60773c4a2ecbbd991fe693fd [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// 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/*---
5description: RestElement applied to an exhausted iterator (`var` statement)
6esid: sec-variable-statement-runtime-semantics-evaluation
7es6id: 13.3.2.4
8features: [Symbol.iterator, destructuring-binding]
9flags: [generated]
10info: |
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
31var [, , ...x] = [1, 2];
32
33assert(Array.isArray(x));
34assert.sameValue(x.length, 0);