| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-binding/obj-ptrn-rest-val-obj.case |
| 3 |
// - src/dstr-binding/default/for-of-let.template |
| 4 |
/*--- |
| 5 |
description: Rest object contains just unextracted data (for-of statement) |
| 6 |
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation |
| 7 |
features: [object-rest, destructuring-binding] |
| 8 |
flags: [generated] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
IterationStatement : |
| 12 |
for ( ForDeclaration of AssignmentExpression ) Statement |
| 13 |
|
| 14 |
[...] |
| 15 |
3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult, |
| 16 |
lexicalBinding, labelSet). |
| 17 |
|
| 18 |
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation |
| 19 |
|
| 20 |
[...] |
| 21 |
3. Let destructuring be IsDestructuring of lhs. |
| 22 |
[...] |
| 23 |
5. Repeat |
| 24 |
[...] |
| 25 |
h. If destructuring is false, then |
| 26 |
[...] |
| 27 |
i. Else |
| 28 |
i. If lhsKind is assignment, then |
| 29 |
[...] |
| 30 |
ii. Else if lhsKind is varBinding, then |
| 31 |
[...] |
| 32 |
iii. Else, |
| 33 |
1. Assert: lhsKind is lexicalBinding. |
| 34 |
2. Assert: lhs is a ForDeclaration. |
| 35 |
3. Let status be the result of performing BindingInitialization |
| 36 |
for lhs passing nextValue and iterationEnv as arguments. |
| 37 |
[...] |
| 38 |
---*/ |
| 39 |
|
| 40 |
var iterCount = 0; |
| 41 |
|
| 42 |
for (let {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) { |
| 43 |
assert.sameValue(rest.a, undefined); |
| 44 |
assert.sameValue(rest.b, undefined); |
| 45 |
|
| 46 |
verifyProperty(rest, "x", { |
| 47 |
enumerable: true, |
| 48 |
writable: true, |
| 49 |
configurable: true, |
| 50 |
value: 1 |
| 51 |
}); |
| 52 |
|
| 53 |
verifyProperty(rest, "y", { |
| 54 |
enumerable: true, |
| 55 |
writable: true, |
| 56 |
configurable: true, |
| 57 |
value: 2 |
| 58 |
}); |
| 59 |
|
| 60 |
iterCount += 1; |
| 61 |
} |
| 62 |
|
| 63 |
assert.sameValue(iterCount, 1, 'Iteration occurred as expected'); |
| 64 |
|
| 65 |
reportCompare(0, 0); |