Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/statements/const/dstr-ary-ptrn-rest-ary-elision.js

raw symbols SCIP
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-elision.case
3 // - src/dstr-binding/default/const-stmt.template
4 /*---
5 description: Rest element containing an elision (`const` statement)
6 esid: sec-let-and-const-declarations-runtime-semantics-evaluation
7 es6id: 13.3.1.4
8 features: [generators, destructuring-binding]
9 flags: [generated]
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 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
21
22 BindingRestElement : ... BindingPattern
23
24 1. Let A be ArrayCreate(0).
25 [...]
26 3. Repeat
27 [...]
28 b. If iteratorRecord.[[done]] is true, then
29 i. Return the result of performing BindingInitialization of
30 BindingPattern with A and environment as the arguments.
31 [...]
32
33 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
34
35 ArrayBindingPattern : [ Elision ]
36
37 1. Return the result of performing
38 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
39 as the argument.
40
41 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
42
43 Elision : ,
44
45 1. If iteratorRecord.[[done]] is false, then
46 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
47 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
48 c. ReturnIfAbrupt(next).
49 d. If next is false, set iteratorRecord.[[done]] to true.
50 2. Return NormalCompletion(empty).
51
52 ---*/
53 var first = 0;
54 var second = 0;
55 function* g() {
56 first += 1;
57 yield;
58 second += 1;
59 };
60
61 const [...[,]] = g();
62
63 assert.sameValue(first, 1);
64 assert.sameValue(second, 1);