obj-ptrn-rest-getter.js (1031B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/obj-ptrn-rest-getter.case 3 // - src/dstr-binding/default/const-stmt.template 4 /*--- 5 description: Getter is called when obj is being deconstructed to a rest Object (`const` statement) 6 esid: sec-let-and-const-declarations-runtime-semantics-evaluation 7 features: [object-rest, destructuring-binding] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 LexicalBinding : BindingPattern Initializer 12 13 1. Let rhs be the result of evaluating Initializer. 14 2. Let value be GetValue(rhs). 15 3. ReturnIfAbrupt(value). 16 4. Let env be the running execution context's LexicalEnvironment. 17 5. Return the result of performing BindingInitialization for BindingPattern 18 using value and env as the arguments. 19 ---*/ 20 var count = 0; 21 22 const {...x} = { get v() { count++; return 2; } }; 23 24 assert.sameValue(count, 1); 25 26 verifyProperty(x, "v", { 27 enumerable: true, 28 writable: true, 29 configurable: true, 30 value: 2 31 }); 32 33 reportCompare(0, 0);