tor-browser

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

named-dflt-ary-ptrn-rest-id-iter-step-err.js (1663B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
      3 // - src/dstr-binding/error/async-gen-func-named-expr-dflt.template
      4 /*---
      5 description: Error forwarding when IteratorStep returns an abrupt completion (async generator named function expression (default parameter))
      6 esid: sec-asyncgenerator-definitions-evaluation
      7 features: [generators, async-iteration]
      8 flags: [generated]
      9 info: |
     10    AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
     11        ( FormalParameters ) { AsyncGeneratorBody }
     12 
     13        [...]
     14        7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
     15           AsyncGeneratorBody, funcEnv, strict).
     16        [...]
     17 
     18    13.3.3.6 Runtime Semantics: IteratorBindingInitialization
     19    BindingRestElement : ... BindingIdentifier
     20    1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
     21       environment).
     22    2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
     23       a. If iteratorRecord.[[done]] is false,
     24          i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
     25          ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
     26              true.
     27          iii. ReturnIfAbrupt(next).
     28 
     29 ---*/
     30 var first = 0;
     31 var second = 0;
     32 var iter = function*() {
     33  first += 1;
     34  throw new Test262Error();
     35  second += 1;
     36 }();
     37 
     38 
     39 var f;
     40 f = async function* h([...x] = iter) {
     41  
     42 };
     43 
     44 assert.throws(Test262Error, function() {
     45  f();
     46 });
     47 
     48 iter.next();
     49 assert.sameValue(first, 1);
     50 assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
     51 
     52 reportCompare(0, 0);