tor-browser

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

cpn-class-expr-computed-property-name-from-assignment-expression-assignment.js (1239B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case
      3 // - src/computed-property-names/evaluation/class-expression.template
      4 /*---
      5 description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression)
      6 esid: prod-ComputedPropertyName
      7 features: [computed-property-names]
      8 flags: [generated]
      9 info: |
     10    ClassExpression:
     11      classBindingIdentifier opt ClassTail
     12 
     13    ClassTail:
     14      ClassHeritage opt { ClassBody opt }
     15 
     16    ClassBody:
     17      ClassElementList
     18 
     19    ClassElementList:
     20      ClassElement
     21 
     22    ClassElement:
     23      MethodDefinition
     24 
     25    MethodDefinition:
     26      PropertyName ...
     27      get PropertyName ...
     28      set PropertyName ...
     29 
     30    PropertyName:
     31      ComputedPropertyName
     32 
     33    ComputedPropertyName:
     34      [ AssignmentExpression ]
     35 ---*/
     36 let x = 0;
     37 
     38 
     39 let C = class {
     40  [x = 1]() {
     41    return 2;
     42  }
     43  static [x = 1]() {
     44    return 2;
     45  }
     46 };
     47 
     48 let c = new C();
     49 
     50 assert.sameValue(
     51  c[x = 1](),
     52  2
     53 );
     54 assert.sameValue(
     55  C[x = 1](),
     56  2
     57 );
     58 assert.sameValue(
     59  c[String(x = 1)](),
     60  2
     61 );
     62 assert.sameValue(
     63  C[String(x = 1)](),
     64  2
     65 );
     66 
     67 assert.sameValue(x, 1);
     68 
     69 reportCompare(0, 0);