tor-browser

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

new-no-sc-line-method-private-field-usage.js (1398B)


      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-new-no-sc-line-method.template
      4 /*---
      5 description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line without a semicolon)
      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';
     27  m() { return 42; }
     28  method() {
     29    return this.#m;
     30  }
     31 }
     32 
     33 var c = new C();
     34 
     35 assert.sameValue(c.m(), 42);
     36 assert.sameValue(c.m, C.prototype.m);
     37 assert(
     38  !Object.prototype.hasOwnProperty.call(c, "m"),
     39  "m doesn't appear as an own property on the C instance"
     40 );
     41 
     42 verifyProperty(C.prototype, "m", {
     43  enumerable: false,
     44  configurable: true,
     45  writable: true,
     46 });
     47 
     48 assert.sameValue(c.method(), 'test262');
     49 
     50 reportCompare(0, 0);