tor-browser

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

same-line-method-private-field-usage.js (1375B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/private-field-usage.case
      3 // - src/class-elements/productions/cls-decl-same-line-method.template
      4 /*---
      5 description: PrivateName CallExpression usage (private field) (field definitions followed by a method in the same line)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-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 class C {
     26  #m = 'test262';; m() { return 42; }
     27  method() {
     28    return this.#m;
     29  }
     30 }
     31 
     32 var c = new C();
     33 
     34 assert.sameValue(c.m(), 42);
     35 assert.sameValue(c.m, C.prototype.m);
     36 assert(
     37  !Object.prototype.hasOwnProperty.call(c, "m"),
     38  "m doesn't appear as an own property on the C instance"
     39 );
     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);