tor-browser

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

obj-ptrn-id-init-skipped.js (1246B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/obj-ptrn-id-init-skipped.case
      3 // - src/dstr-binding/default/try.template
      4 /*---
      5 description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
      6 esid: sec-runtime-semantics-catchclauseevaluation
      7 features: [destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    Catch : catch ( CatchParameter ) Block
     11 
     12    [...]
     13    5. Let status be the result of performing BindingInitialization for
     14       CatchParameter passing thrownValue and catchEnv as arguments.
     15    [...]
     16 
     17    13.3.3.7 Runtime Semantics: KeyedBindingInitialization
     18 
     19    SingleNameBinding : BindingIdentifier Initializeropt
     20 
     21    [...]
     22    6. If Initializer is present and v is undefined, then
     23       [...]
     24    [...]
     25 ---*/
     26 var initCount = 0;
     27 function counter() {
     28  initCount += 1;
     29 }
     30 
     31 var ranCatch = false;
     32 
     33 try {
     34  throw { w: null, x: 0, y: false, z: '' };
     35 } catch ({ w = counter(), x = counter(), y = counter(), z = counter() }) {
     36  assert.sameValue(w, null);
     37  assert.sameValue(x, 0);
     38  assert.sameValue(y, false);
     39  assert.sameValue(z, '');
     40  assert.sameValue(initCount, 0);
     41  ranCatch = true;
     42 }
     43 
     44 assert(ranCatch, 'executed `catch` block');
     45 
     46 reportCompare(0, 0);