tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

spread-obj-getter-init.js (1254B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/spread/obj-getter-init.case
      3 // - src/spread/default/array.template
      4 /*---
      5 description: Getter in object literal is not evaluated (Array initializer)
      6 esid: sec-runtime-semantics-arrayaccumulation
      7 features: [object-spread]
      8 flags: [generated]
      9 info: |
     10    SpreadElement : ...AssignmentExpression
     11 
     12    1. Let spreadRef be the result of evaluating AssignmentExpression.
     13    2. Let spreadObj be ? GetValue(spreadRef).
     14    3. Let iterator be ? GetIterator(spreadObj).
     15    4. Repeat
     16       a. Let next be ? IteratorStep(iterator).
     17       b. If next is false, return nextIndex.
     18       c. Let nextValue be ? IteratorValue(next).
     19       d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
     20          nextValue).
     21       e. Assert: status is true.
     22       f. Let nextIndex be nextIndex + 1.
     23 ---*/
     24 
     25 let o = {a: 2, b: 3};
     26 let executedGetter = false;
     27 
     28 
     29 var callCount = 0;
     30 
     31 (function(obj) {
     32  assert.sameValue(obj.a, 2);
     33  assert.sameValue(obj.b, 3);
     34  assert.sameValue(executedGetter, false)
     35  assert.sameValue(Object.keys(obj).length, 3);
     36  callCount += 1;
     37 }.apply(null, [{...o, get c() { executedGetter = true; }}]));
     38 
     39 assert.sameValue(callCount, 1);
     40 
     41 reportCompare(0, 0);