var-obj-ptrn-rest-skip-non-enumerable.js (1741B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case 3 // - src/dstr-binding/default/for-var.template 4 /*--- 5 description: Rest object doesn't contain non-enumerable properties (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 o = {a: 3, b: 4}; 34 Object.defineProperty(o, "x", { value: 4, enumerable: false }); 35 36 var iterCount = 0; 37 38 for (var {...rest} = o; iterCount < 1; ) { 39 assert.sameValue(rest.x, undefined); 40 41 verifyProperty(rest, "a", { 42 enumerable: true, 43 writable: true, 44 configurable: true, 45 value: 3 46 }); 47 48 verifyProperty(rest, "b", { 49 enumerable: true, 50 writable: true, 51 configurable: true, 52 value: 4 53 }); 54 iterCount += 1; 55 } 56 57 assert.sameValue(iterCount, 1, 'Iteration occurred as expected'); 58 59 reportCompare(0, 0);