obj-rest-valid-object.js (1171B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-assignment/obj-rest-valid-object.case 3 // - src/dstr-assignment/default/assignment-expr.template 4 /*--- 5 description: Rest object contains just unextracted data (AssignmentExpression) 6 esid: sec-variable-statement-runtime-semantics-evaluation 7 features: [object-rest, destructuring-binding] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 VariableDeclaration : BindingPattern Initializer 12 13 1. Let rhs be the result of evaluating Initializer. 14 2. Let rval be GetValue(rhs). 15 3. ReturnIfAbrupt(rval). 16 4. Return the result of performing BindingInitialization for 17 BindingPattern passing rval and undefined as arguments. 18 ---*/ 19 var rest, a, b; 20 21 22 var result; 23 var vals = {x: 1, y: 2, a: 5, b: 3}; 24 25 result = {a, b, ...rest} = vals; 26 27 assert.sameValue(rest.a, undefined); 28 assert.sameValue(rest.b, undefined); 29 30 verifyProperty(rest, "x", { 31 enumerable: true, 32 writable: true, 33 configurable: true, 34 value: 1 35 }); 36 37 verifyProperty(rest, "y", { 38 enumerable: true, 39 writable: true, 40 configurable: true, 41 value: 2 42 }); 43 44 assert.sameValue(result, vals); 45 46 reportCompare(0, 0);