tor-browser

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

multiple-definitions-rs-static-method-privatename-identifier.js (3832B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/rs-static-method-privatename-identifier.case
      3 // - src/class-elements/productions/cls-decl-multiple-definitions.template
      4 /*---
      5 description: Valid Static Method PrivateName (multiple fields definitions)
      6 esid: prod-FieldDefinition
      7 features: [class-static-methods-private, class, class-fields-public]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    ClassElement :
     12      MethodDefinition
     13      static MethodDefinition
     14      FieldDefinition ;
     15      static FieldDefinition ;
     16      ;
     17 
     18    MethodDefinition :
     19      ClassElementName ( UniqueFormalParameters ){ FunctionBody }
     20 
     21    ClassElementName :
     22      PropertyName
     23      PrivateName
     24 
     25    PrivateName ::
     26      # IdentifierName
     27 
     28    IdentifierName ::
     29      IdentifierStart
     30      IdentifierName IdentifierPart
     31 
     32    IdentifierStart ::
     33      UnicodeIDStart
     34      $
     35      _
     36      \ UnicodeEscapeSequence
     37 
     38    IdentifierPart::
     39      UnicodeIDContinue
     40      $
     41      \ UnicodeEscapeSequence
     42      <ZWNJ> <ZWJ>
     43 
     44    UnicodeIDStart::
     45      any Unicode code point with the Unicode property "ID_Start"
     46 
     47    UnicodeIDContinue::
     48      any Unicode code point with the Unicode property "ID_Continue"
     49 
     50 
     51    NOTE 3
     52    The sets of code points with Unicode properties "ID_Start" and
     53    "ID_Continue" include, respectively, the code points with Unicode
     54    properties "Other_ID_Start" and "Other_ID_Continue".
     55 
     56 ---*/
     57 
     58 
     59 class C {
     60  foo = "foobar";
     61  m() { return 42 }
     62  static #$(value) {
     63    return value;
     64  }
     65  static #_(value) {
     66    return value;
     67  }
     68  static #\u{6F}(value) {
     69    return value;
     70  }
     71  static #\u2118(value) {
     72    return value;
     73  }
     74  static #ZW_\u200C_NJ(value) {
     75    return value;
     76  }
     77  static #ZW_\u200D_J(value) {
     78    return value;
     79  }
     80  m2() { return 39 }
     81  bar = "barbaz";
     82  static $(value) {
     83    return this.#$(value);
     84  }
     85  static _(value) {
     86    return this.#_(value);
     87  }
     88  static \u{6F}(value) {
     89    return this.#\u{6F}(value);
     90  }
     91  static \u2118(value) {
     92    return this.#\u2118(value);
     93  }
     94  static ZW_\u200C_NJ(value) {
     95    return this.#ZW_\u200C_NJ(value);
     96  }
     97  static ZW_\u200D_J(value) {
     98    return this.#ZW_\u200D_J(value);
     99  }
    100 
    101 }
    102 
    103 var c = new C();
    104 
    105 assert.sameValue(c.m(), 42);
    106 assert(
    107  !Object.prototype.hasOwnProperty.call(c, "m"),
    108  "m doesn't appear as an own property on the C instance"
    109 );
    110 assert.sameValue(c.m, C.prototype.m);
    111 
    112 verifyProperty(C.prototype, "m", {
    113  enumerable: false,
    114  configurable: true,
    115  writable: true,
    116 });
    117 
    118 assert.sameValue(c.m2(), 39);
    119 assert(!
    120  Object.prototype.hasOwnProperty.call(c, "m2"),
    121  "m2 doesn't appear as an own property on the C instance"
    122 );
    123 assert.sameValue(c.m2, C.prototype.m2);
    124 
    125 verifyProperty(C.prototype, "m2", {
    126  enumerable: false,
    127  configurable: true,
    128  writable: true,
    129 });
    130 
    131 assert.sameValue(c.foo, "foobar");
    132 assert(
    133  !Object.prototype.hasOwnProperty.call(C, "foo"),
    134  "foo doesn't appear as an own property on the C constructor"
    135 );
    136 assert(
    137  !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
    138  "foo doesn't appear as an own property on the C prototype"
    139 );
    140 
    141 verifyProperty(c, "foo", {
    142  value: "foobar",
    143  enumerable: true,
    144  configurable: true,
    145  writable: true,
    146 });
    147 
    148 assert.sameValue(c.bar, "barbaz");
    149 assert(
    150  !Object.prototype.hasOwnProperty.call(C, "bar"),
    151  "bar doesn't appear as an own property on the C constructor"
    152 );
    153 assert(
    154  !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
    155  "bar doesn't appear as an own property on the C prototype"
    156 );
    157 
    158 verifyProperty(c, "bar", {
    159  value: "barbaz",
    160  enumerable: true,
    161  configurable: true,
    162  writable: true,
    163 });
    164 
    165 assert.sameValue(C.$(1), 1);
    166 assert.sameValue(C._(1), 1);
    167 assert.sameValue(C.\u{6F}(1), 1);
    168 assert.sameValue(C.\u2118(1), 1);
    169 assert.sameValue(C.ZW_\u200C_NJ(1), 1);
    170 assert.sameValue(C.ZW_\u200D_J(1), 1);
    171 
    172 
    173 reportCompare(0, 0);