tor-browser

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

multiple-stacked-definitions-computed-symbol-names.js (3002B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/computed-symbol-names.case
      3 // - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
      4 /*---
      5 description: Computed property symbol names (multiple stacked fields definitions through ASI)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, Symbol, computed-property-names, class]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    ClassElement:
     12      ...
     13      FieldDefinition ;
     14 
     15    FieldDefinition:
     16      ClassElementName Initializer_opt
     17 
     18    ClassElementName:
     19      PropertyName
     20 
     21 ---*/
     22 var x = Symbol();
     23 var y = Symbol();
     24 
     25 
     26 
     27 class C {
     28  [x]; [y] = 42
     29  foo = "foobar"
     30  bar = "barbaz";
     31  
     32 }
     33 
     34 var c = new C();
     35 
     36 assert.sameValue(c.foo, "foobar");
     37 assert(
     38  !Object.prototype.hasOwnProperty.call(C, "foo"),
     39  "foo doesn't appear as an own property on the C constructor"
     40 );
     41 assert(
     42  !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
     43  "foo doesn't appear as an own property on the C prototype"
     44 );
     45 
     46 verifyProperty(c, "foo", {
     47  value: "foobar",
     48  enumerable: true,
     49  configurable: true,
     50  writable: true,
     51 });
     52 
     53 assert.sameValue(c.bar, "barbaz");
     54 assert(
     55  !Object.prototype.hasOwnProperty.call(C, "bar"),
     56  "bar doesn't appear as an own property on the C constructor"
     57 );
     58 assert(
     59  !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
     60  "bar doesn't appear as an own property on the C prototype"
     61 );
     62 
     63 verifyProperty(c, "bar", {
     64  value: "barbaz",
     65  enumerable: true,
     66  configurable: true,
     67  writable: true,
     68 });
     69 
     70 assert(
     71  !Object.prototype.hasOwnProperty.call(C.prototype, x),
     72  "Symbol x doesn't appear as an own property on C prototype"
     73 );
     74 assert(
     75  !Object.prototype.hasOwnProperty.call(C, x),
     76  "Symbol x doesn't appear as an own property on C constructor"
     77 );
     78 
     79 verifyProperty(c, x, {
     80  value: undefined,
     81  enumerable: true,
     82  writable: true,
     83  configurable: true
     84 });
     85 
     86 assert(
     87  !Object.prototype.hasOwnProperty.call(C.prototype, y),
     88  "Symbol y doesn't appear as an own property on C prototype"
     89 );
     90 assert(
     91  !Object.prototype.hasOwnProperty.call(C, y),
     92  "Symbol y doesn't appear as an own property on C constructor"
     93 );
     94 
     95 verifyProperty(c, y, {
     96  value: 42,
     97  enumerable: true,
     98  writable: true,
     99  configurable: true
    100 });
    101 
    102 assert(
    103  !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
    104  "x doesn't appear as an own property on C prototype"
    105 );
    106 assert(
    107  !Object.prototype.hasOwnProperty.call(C, "x"),
    108  "x doesn't appear as an own property on C constructor"
    109 );
    110 assert(
    111  !Object.prototype.hasOwnProperty.call(c, "x"),
    112  "x doesn't appear as an own property on C instance"
    113 );
    114 
    115 assert(
    116  !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
    117  "y doesn't appear as an own property on C prototype"
    118 );
    119 assert(
    120  !Object.prototype.hasOwnProperty.call(C, "y"),
    121  "y doesn't appear as an own property on C constructor"
    122 );
    123 assert(
    124  !Object.prototype.hasOwnProperty.call(c, "y"),
    125  "y doesn't appear as an own property on C instance"
    126 );
    127 
    128 reportCompare(0, 0);