tor-browser

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

yield-star-expr-abrupt.js (1527B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/async-generators/yield-star-expr-abrupt.case
      4 // - src/async-generators/default/async-class-decl-static-method.template
      5 /*---
      6 description: Abrupt completion while getting yield* operand (Static async generator method as a ClassDeclaration element)
      7 esid: prod-AsyncGeneratorMethod
      8 features: [async-iteration]
      9 flags: [generated, async]
     10 info: |
     11    ClassElement :
     12      static MethodDefinition
     13 
     14    MethodDefinition :
     15      AsyncGeneratorMethod
     16 
     17    Async Generator Function Definitions
     18 
     19    AsyncGeneratorMethod :
     20      async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
     21 
     22 
     23    YieldExpression: yield * AssignmentExpression
     24 
     25    1. Let exprRef be the result of evaluating AssignmentExpression.
     26    2. Let value be ? GetValue(exprRef).
     27    ...
     28 
     29 ---*/
     30 var obj = {};
     31 var abrupt = function() {
     32  throw obj;
     33 };
     34 
     35 
     36 
     37 var callCount = 0;
     38 
     39 class C { static async *gen() {
     40    callCount += 1;
     41    yield* abrupt();
     42      throw new Test262Error('abrupt completion closes iter');
     43 
     44 }}
     45 
     46 var gen = C.gen;
     47 
     48 var iter = gen();
     49 
     50 iter.next().then(() => {
     51  throw new Test262Error('Promise incorrectly fulfilled.');
     52 }, v => {
     53  assert.sameValue(v, obj, "reject reason");
     54 
     55  iter.next().then(({ done, value }) => {
     56    assert.sameValue(done, true, 'the iterator is completed');
     57    assert.sameValue(value, undefined, 'value is undefined');
     58  }).then($DONE, $DONE);
     59 }).catch($DONE);
     60 
     61 assert.sameValue(callCount, 1);