tor-browser

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

ary-ptrn-elision.js (1517B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/ary-ptrn-elision.case
      3 // - src/dstr-binding/default/try.template
      4 /*---
      5 description: Elision advances iterator (try statement)
      6 esid: sec-runtime-semantics-catchclauseevaluation
      7 features: [generators, 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.6 Runtime Semantics: IteratorBindingInitialization
     18 
     19    ArrayBindingPattern : [ Elision ]
     20 
     21    1. Return the result of performing
     22       IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
     23       as the argument.
     24 
     25    12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
     26 
     27    Elision : ,
     28 
     29    1. If iteratorRecord.[[done]] is false, then
     30       a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
     31       b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
     32       c. ReturnIfAbrupt(next).
     33       d. If next is false, set iteratorRecord.[[done]] to true.
     34    2. Return NormalCompletion(empty).
     35 
     36 ---*/
     37 var first = 0;
     38 var second = 0;
     39 function* g() {
     40  first += 1;
     41  yield;
     42  second += 1;
     43 };
     44 
     45 var ranCatch = false;
     46 
     47 try {
     48  throw g();
     49 } catch ([,]) {
     50  assert.sameValue(first, 1);
     51  assert.sameValue(second, 0);
     52  ranCatch = true;
     53 }
     54 
     55 assert(ranCatch, 'executed `catch` block');
     56 
     57 reportCompare(0, 0);