tor-browser

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

multiple-definitions-rs-field-identifier-initializer.js (3143B)


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