tor-browser

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

after-same-line-static-method-computed-names.js (2609B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/computed-names.case
      3 // - src/class-elements/productions/cls-expr-after-same-line-static-method.template
      4 /*---
      5 description: Computed property names (field definitions after a static method in the same line)
      6 esid: prod-FieldDefinition
      7 features: [class-fields-public, 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 = "b";
     23 
     24 
     25 
     26 var C = class {
     27  static m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
     28  
     29 }
     30 
     31 var c = new C();
     32 
     33 assert.sameValue(C.m(), 42);
     34 assert(
     35  !Object.prototype.hasOwnProperty.call(c, "m"),
     36  "m doesn't appear as an own property on the C instance"
     37 );
     38 assert(
     39  !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
     40  "m doesn't appear as an own property on the C prototype"
     41 );
     42 
     43 verifyProperty(C, "m", {
     44  enumerable: false,
     45  configurable: true,
     46  writable: true,
     47 });
     48 
     49 assert(
     50  !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     51  "b doesn't appear as an own property on C prototype"
     52 );
     53 assert(
     54  !Object.prototype.hasOwnProperty.call(C, "b"),
     55  "b doesn't appear as an own property on C constructor"
     56 );
     57 
     58 verifyProperty(c, "b", {
     59  value: 42,
     60  enumerable: true,
     61  writable: true,
     62  configurable: true
     63 });
     64 
     65 assert(
     66  !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
     67  "x doesn't appear as an own property on C prototype"
     68 );
     69 assert(
     70  !Object.prototype.hasOwnProperty.call(C, "x"),
     71  "x doesn't appear as an own property on C constructor"
     72 );
     73 assert(
     74  !Object.prototype.hasOwnProperty.call(c, "x"),
     75  "x doesn't appear as an own property on C instance"
     76 );
     77 
     78 assert(
     79  !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
     80  "10 doesn't appear as an own property on C prototype"
     81 );
     82 assert(
     83  !Object.prototype.hasOwnProperty.call(C, "10"),
     84  "10 doesn't appear as an own property on C constructor"
     85 );
     86 
     87 verifyProperty(c, "10", {
     88  value: "meep",
     89  enumerable: true,
     90  writable: true,
     91  configurable: true
     92 });
     93 
     94 assert(
     95  !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
     96  "'not initialized' doesn't appear as an own property on C prototype"
     97 );
     98 assert(
     99  !Object.prototype.hasOwnProperty.call(C, "not initialized"),
    100  "'not initialized' doesn't appear as an own property on C constructor"
    101 );
    102 
    103 verifyProperty(c, "not initialized", {
    104  value: undefined,
    105  enumerable: true,
    106  writable: true,
    107  configurable: true
    108 });
    109 
    110 reportCompare(0, 0);