Debian Codegraph @

js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-direct.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-id-direct.case
3 // - src/dstr-binding/default/const-stmt.template
4 /*---
5 description: Lone rest element (direct binding) (`const` statement)
6 esid: sec-let-and-const-declarations-runtime-semantics-evaluation
7 features: [destructuring-binding]
8 flags: [generated]
9 includes: [compareArray.js]
10 info: |
11 LexicalBinding : BindingPattern Initializer
12
13 1. Let rhs be the result of evaluating Initializer.
14 2. Let value be GetValue(rhs).
15 3. ReturnIfAbrupt(value).
16 4. Let env be the running execution context's LexicalEnvironment.
17 5. Return the result of performing BindingInitialization for BindingPattern
18 using value and env as the arguments.
19
20 Runtime Semantics: IteratorBindingInitialization
21
22 BindingRestElement : ... BindingIdentifier
23
24 [...]
25 2. Let A be ! ArrayCreate(0).
26 3. Let n be 0.
27 4. Repeat,
28 [...]
29 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
30 g. Set n to n + 1.
31
32 ---*/
33
34 const [...x] = [1];
35
36 assert(Array.isArray(x));
37 assert.compareArray(x, [1]);
38
39 reportCompare(0, 0);