Debian Codegraph @

js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-getter.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/obj-ptrn-rest-getter.case
3 // - src/dstr-binding/default/for-var.template
4 /*---
5 description: Getter is called when obj is being deconstructed to a rest Object (for statement)
6 esid: sec-for-statement-runtime-semantics-labelledevaluation
7 features: [object-rest, destructuring-binding]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 IterationStatement :
12 for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
13
14 1. Let varDcl be the result of evaluating VariableDeclarationList.
15 [...]
16
17 13.3.2.4 Runtime Semantics: Evaluation
18
19 VariableDeclarationList : VariableDeclarationList , VariableDeclaration
20
21 1. Let next be the result of evaluating VariableDeclarationList.
22 2. ReturnIfAbrupt(next).
23 3. Return the result of evaluating VariableDeclaration.
24
25 VariableDeclaration : BindingPattern Initializer
26
27 1. Let rhs be the result of evaluating Initializer.
28 2. Let rval be GetValue(rhs).
29 3. ReturnIfAbrupt(rval).
30 4. Return the result of performing BindingInitialization for BindingPattern
31 passing rval and undefined as arguments.
32 ---*/
33 var count = 0;
34
35 var iterCount = 0;
36
37 for (var {...x} = { get v() { count++; return 2; } }; iterCount < 1; ) {
38 assert.sameValue(count, 1);
39
40 verifyProperty(x, "v", {
41 enumerable: true,
42 writable: true,
43 configurable: true,
44 value: 2
45 });
46 iterCount += 1;
47 }
48
49 assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
50
51 reportCompare(0, 0);