tor-browser

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

after-same-line-method-computed-symbol-names.js (2466B)


      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-after-same-line-method.template
      4 /*---
      5 description: Computed property symbol names (field definitions after a method in the same line)
      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  m() { return 42; } [x]; [y] = 42;
     29  
     30 }
     31 
     32 var c = new C();
     33 
     34 assert.sameValue(c.m(), 42);
     35 assert(
     36  !Object.prototype.hasOwnProperty.call(c, "m"),
     37  "m doesn't appear as an own property on the C instance"
     38 );
     39 assert.sameValue(c.m, C.prototype.m);
     40 
     41 verifyProperty(C.prototype, "m", {
     42  enumerable: false,
     43  configurable: true,
     44  writable: true,
     45 });
     46 
     47 assert(
     48  !Object.prototype.hasOwnProperty.call(C.prototype, x),
     49  "Symbol x doesn't appear as an own property on C prototype"
     50 );
     51 assert(
     52  !Object.prototype.hasOwnProperty.call(C, x),
     53  "Symbol x doesn't appear as an own property on C constructor"
     54 );
     55 
     56 verifyProperty(c, x, {
     57  value: undefined,
     58  enumerable: true,
     59  writable: true,
     60  configurable: true
     61 });
     62 
     63 assert(
     64  !Object.prototype.hasOwnProperty.call(C.prototype, y),
     65  "Symbol y doesn't appear as an own property on C prototype"
     66 );
     67 assert(
     68  !Object.prototype.hasOwnProperty.call(C, y),
     69  "Symbol y doesn't appear as an own property on C constructor"
     70 );
     71 
     72 verifyProperty(c, y, {
     73  value: 42,
     74  enumerable: true,
     75  writable: true,
     76  configurable: true
     77 });
     78 
     79 assert(
     80  !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
     81  "x doesn't appear as an own property on C prototype"
     82 );
     83 assert(
     84  !Object.prototype.hasOwnProperty.call(C, "x"),
     85  "x doesn't appear as an own property on C constructor"
     86 );
     87 assert(
     88  !Object.prototype.hasOwnProperty.call(c, "x"),
     89  "x doesn't appear as an own property on C instance"
     90 );
     91 
     92 assert(
     93  !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
     94  "y doesn't appear as an own property on C prototype"
     95 );
     96 assert(
     97  !Object.prototype.hasOwnProperty.call(C, "y"),
     98  "y doesn't appear as an own property on C constructor"
     99 );
    100 assert(
    101  !Object.prototype.hasOwnProperty.call(c, "y"),
    102  "y doesn't appear as an own property on C instance"
    103 );
    104 
    105 reportCompare(0, 0);