tor-browser

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

wrapped-in-sc-computed-symbol-names.js (2167B)


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