Debian Codegraph @

js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-exhausted.js

raw
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 features: [Symbol.iterator, destructuring-binding]
8 flags: [generated]
9 info: |
10 VariableDeclaration : BindingPattern Initializer
11
12 1. Let rhs be the result of evaluating Initializer.
13 2. Let rval be GetValue(rhs).
14 3. ReturnIfAbrupt(rval).
15 4. Return the result of performing BindingInitialization for
16 BindingPattern passing rval and undefined as arguments.
17
18 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
19 BindingRestElement : ... BindingIdentifier
20 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
21 environment).
22 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
23 [...]
24 b. If iteratorRecord.[[done]] is true, then
25 i. If environment is undefined, return PutValue(lhs, A).
26 ii. Return InitializeReferencedBinding(lhs, A).
27
28 ---*/
29
30 var [, , ...x] = [1, 2];
31
32 assert(Array.isArray(x));
33 assert.sameValue(x.length, 0);
34
35 reportCompare(0, 0);