tor-browser

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

regular-definitions-computed-names.js (2166B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/computed-names.case
      3 // - src/class-elements/productions/cls-decl-regular-definitions.template
      4 /*---
      5 description: Computed property names (regular fields defintion)
      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 class C {
     27  [x] = 42; [10] = "meep"; ["not initialized"]
     28  
     29 }
     30 
     31 var c = new C();
     32 
     33 assert(
     34  !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
     35  "b doesn't appear as an own property on C prototype"
     36 );
     37 assert(
     38  !Object.prototype.hasOwnProperty.call(C, "b"),
     39  "b doesn't appear as an own property on C constructor"
     40 );
     41 
     42 verifyProperty(c, "b", {
     43  value: 42,
     44  enumerable: true,
     45  writable: true,
     46  configurable: true
     47 });
     48 
     49 assert(
     50  !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
     51  "x doesn't appear as an own property on C prototype"
     52 );
     53 assert(
     54  !Object.prototype.hasOwnProperty.call(C, "x"),
     55  "x doesn't appear as an own property on C constructor"
     56 );
     57 assert(
     58  !Object.prototype.hasOwnProperty.call(c, "x"),
     59  "x doesn't appear as an own property on C instance"
     60 );
     61 
     62 assert(
     63  !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
     64  "10 doesn't appear as an own property on C prototype"
     65 );
     66 assert(
     67  !Object.prototype.hasOwnProperty.call(C, "10"),
     68  "10 doesn't appear as an own property on C constructor"
     69 );
     70 
     71 verifyProperty(c, "10", {
     72  value: "meep",
     73  enumerable: true,
     74  writable: true,
     75  configurable: true
     76 });
     77 
     78 assert(
     79  !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
     80  "'not initialized' doesn't appear as an own property on C prototype"
     81 );
     82 assert(
     83  !Object.prototype.hasOwnProperty.call(C, "not initialized"),
     84  "'not initialized' doesn't appear as an own property on C constructor"
     85 );
     86 
     87 verifyProperty(c, "not initialized", {
     88  value: undefined,
     89  enumerable: true,
     90  writable: true,
     91  configurable: true
     92 });
     93 
     94 reportCompare(0, 0);