tor-browser

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

let-obj-ptrn-rest-getter.js (1719B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/obj-ptrn-rest-getter.case
      3 // - src/dstr-binding/default/for-let.template
      4 /*---
      5 description: Getter is called when obj is being deconstructed to a rest Object (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 ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
     13 
     14    [...]
     15    7. Let forDcl be the result of evaluating LexicalDeclaration.
     16    [...]
     17 
     18    LexicalDeclaration : LetOrConst BindingList ;
     19 
     20    1. Let next be the result of evaluating BindingList.
     21    2. ReturnIfAbrupt(next).
     22    3. Return NormalCompletion(empty).
     23 
     24    BindingList : BindingList , LexicalBinding
     25 
     26    1. Let next be the result of evaluating BindingList.
     27    2. ReturnIfAbrupt(next).
     28    3. Return the result of evaluating LexicalBinding.
     29 
     30    LexicalBinding : BindingPattern Initializer
     31 
     32    1. Let rhs be the result of evaluating Initializer.
     33    2. Let value be GetValue(rhs).
     34    3. ReturnIfAbrupt(value).
     35    4. Let env be the running execution context’s LexicalEnvironment.
     36    5. Return the result of performing BindingInitialization for BindingPattern
     37       using value and env as the arguments.
     38 ---*/
     39 var count = 0;
     40 
     41 var iterCount = 0;
     42 
     43 for (let {...x} = { get v() { count++; return 2; } }; iterCount < 1; ) {
     44  assert.sameValue(count, 1);
     45 
     46  verifyProperty(x, "v", {
     47    enumerable: true,
     48    writable: true,
     49    configurable: true,
     50    value: 2
     51  });
     52 
     53  iterCount += 1;
     54 }
     55 
     56 assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
     57 
     58 reportCompare(0, 0);