tor-browser

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

after-same-line-method-private-method-getter-usage.js (1410B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/private-method-getter-usage.case
      3 // - src/class-elements/productions/cls-expr-after-same-line-method.template
      4 /*---
      5 description: PrivateName CallExpression usage (Accesor get method) (field definitions after a method in the same line)
      6 esid: prod-FieldDefinition
      7 features: [class-methods-private, class, class-fields-public]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    Updated Productions
     12 
     13    CallExpression[Yield, Await]:
     14      CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
     15      SuperCall[?Yield, ?Await]
     16      CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
     17      CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
     18      CallExpression[?Yield, ?Await].IdentifierName
     19      CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
     20      CallExpression[?Yield, ?Await].PrivateName
     21 
     22 ---*/
     23 
     24 
     25 var C = class {
     26  m() { return 42; } get #m() { return 'test262'; };
     27  method() {
     28    return this.#m;
     29  }
     30 }
     31 
     32 var c = new C();
     33 
     34 assert.sameValue(c.m(), 42);
     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.sameValue(c.m, C.prototype.m);
     40 
     41 verifyProperty(C.prototype, "m", {
     42  enumerable: false,
     43  configurable: true,
     44  writable: true,
     45 });
     46 
     47 assert.sameValue(c.method(), 'test262');
     48 
     49 reportCompare(0, 0);