tor-browser

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

var-obj-ptrn-prop-obj-init.js (1934B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/obj-ptrn-prop-obj-init.case
      3 // - src/dstr-binding/default/for-var.template
      4 /*---
      5 description: Object binding pattern with "nested" object binding pattern using initializer (for statement)
      6 esid: sec-for-statement-runtime-semantics-labelledevaluation
      7 features: [destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    IterationStatement :
     11        for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
     12 
     13    1. Let varDcl be the result of evaluating VariableDeclarationList.
     14    [...]
     15 
     16    13.3.2.4 Runtime Semantics: Evaluation
     17 
     18    VariableDeclarationList : VariableDeclarationList , VariableDeclaration
     19 
     20    1. Let next be the result of evaluating VariableDeclarationList.
     21    2. ReturnIfAbrupt(next).
     22    3. Return the result of evaluating VariableDeclaration.
     23 
     24    VariableDeclaration : BindingPattern Initializer
     25 
     26    1. Let rhs be the result of evaluating Initializer.
     27    2. Let rval be GetValue(rhs).
     28    3. ReturnIfAbrupt(rval).
     29    4. Return the result of performing BindingInitialization for BindingPattern
     30       passing rval and undefined as arguments.
     31 
     32    13.3.3.7 Runtime Semantics: KeyedBindingInitialization
     33 
     34    [...]
     35    3. If Initializer is present and v is undefined, then
     36       a. Let defaultValue be the result of evaluating Initializer.
     37       b. Let v be GetValue(defaultValue).
     38       c. ReturnIfAbrupt(v).
     39    4. Return the result of performing BindingInitialization for BindingPattern
     40       passing v and environment as arguments.
     41 ---*/
     42 
     43 var iterCount = 0;
     44 
     45 for (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }; iterCount < 1; ) {
     46  assert.sameValue(x, 4);
     47  assert.sameValue(y, 5);
     48  assert.sameValue(z, 6);
     49 
     50  assert.throws(ReferenceError, function() {
     51    w;
     52  });
     53  iterCount += 1;
     54 }
     55 
     56 assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
     57 
     58 reportCompare(0, 0);