spread-obj-getter-descriptor.js (1739B)
1 // This file was procedurally generated from the following sources: 2 // - src/spread/obj-getter-descriptor.case 3 // - src/spread/default/array.template 4 /*--- 5 description: Spread operation with getter results in data property descriptor (Array initializer) 6 esid: sec-runtime-semantics-arrayaccumulation 7 features: [object-spread] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 SpreadElement : ...AssignmentExpression 12 13 1. Let spreadRef be the result of evaluating AssignmentExpression. 14 2. Let spreadObj be ? GetValue(spreadRef). 15 3. Let iterator be ? GetIterator(spreadObj). 16 4. Repeat 17 a. Let next be ? IteratorStep(iterator). 18 b. If next is false, return nextIndex. 19 c. Let nextValue be ? IteratorValue(next). 20 d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), 21 nextValue). 22 e. Assert: status is true. 23 f. Let nextIndex be nextIndex + 1. 24 25 Pending Runtime Semantics: PropertyDefinitionEvaluation 26 27 PropertyDefinition:...AssignmentExpression 28 29 1. Let exprValue be the result of evaluating AssignmentExpression. 30 2. Let fromValue be GetValue(exprValue). 31 3. ReturnIfAbrupt(fromValue). 32 4. Let excludedNames be a new empty List. 33 5. Return CopyDataProperties(object, fromValue, excludedNames). 34 35 ---*/ 36 let o = { 37 get a() { 38 return 42; 39 } 40 }; 41 42 43 var callCount = 0; 44 45 (function(obj) { 46 assert.sameValue(obj.c, 4); 47 assert.sameValue(obj.d, 5); 48 assert.sameValue(Object.keys(obj).length, 3); 49 50 verifyProperty(obj, "a", { 51 enumerable: true, 52 writable: true, 53 configurable: true, 54 value: 42 55 }); 56 callCount += 1; 57 }.apply(null, [{...o, c: 4, d: 5}])); 58 59 assert.sameValue(callCount, 1); 60 61 reportCompare(0, 0);