tor-browser

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

after-same-line-static-async-gen-private-method-getter-usage.js (1902B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/class-elements/private-method-getter-usage.case
      4 // - src/class-elements/productions/cls-expr-after-same-line-static-async-gen.template
      5 /*---
      6 description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static async generator in the same line)
      7 esid: prod-FieldDefinition
      8 features: [class-methods-private, class, class-fields-public, async-iteration]
      9 flags: [generated, async]
     10 includes: [propertyHelper.js]
     11 info: |
     12    Updated Productions
     13 
     14    CallExpression[Yield, Await]:
     15      CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
     16      SuperCall[?Yield, ?Await]
     17      CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
     18      CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
     19      CallExpression[?Yield, ?Await].IdentifierName
     20      CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
     21      CallExpression[?Yield, ?Await].PrivateName
     22 
     23 ---*/
     24 
     25 
     26 var C = class {
     27  static async *m() { return 42; } get #m() { return 'test262'; };
     28  method() {
     29    return this.#m;
     30  }
     31 }
     32 
     33 var c = new C();
     34 
     35 assert(
     36  !Object.prototype.hasOwnProperty.call(c, "m"),
     37  "m doesn't appear as an own property on the C instance"
     38 );
     39 assert(
     40  !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
     41  "m doesn't appear as an own property on the C prototype"
     42 );
     43 
     44 verifyProperty(C, "m", {
     45  enumerable: false,
     46  configurable: true,
     47  writable: true,
     48 }, {restore: true});
     49 
     50 C.m().next().then(function(v) {
     51  assert.sameValue(v.value, 42);
     52  assert.sameValue(v.done, true);
     53 
     54  function assertions() {
     55    // Cover $DONE handler for async cases.
     56    function $DONE(error) {
     57      if (error) {
     58        throw new Test262Error('Test262:AsyncTestFailure')
     59      }
     60    }
     61    assert.sameValue(c.method(), 'test262');
     62  }
     63 
     64  return Promise.resolve(assertions());
     65 }).then($DONE, $DONE);