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