tor-browser

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

multiple-definitions-rs-private-method-alt.js (3842B)


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