tor-browser

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

cpn-class-expr-accessors-computed-property-name-from-identifier.js (1446B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/computed-property-names/computed-property-name-from-identifier.case
      3 // - src/computed-property-names/evaluation/class-expression-accessors.template
      4 /*---
      5 description: Computed property name from string literal (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 = 1;
     37 
     38 
     39 
     40 let C = class {
     41  get [x]() {
     42    return '2';
     43  }
     44 
     45  set [x](v) {
     46    return '2';
     47  }
     48 
     49  static get [x]() {
     50    return '2';
     51  }
     52 
     53  static set [x](v) {
     54    return '2';
     55  }
     56 };
     57 
     58 let c = new C();
     59 
     60 assert.sameValue(
     61  c[x],
     62  '2'
     63 );
     64 assert.sameValue(
     65  c[x] = '2',
     66  '2'
     67 );
     68 
     69 assert.sameValue(
     70  C[x],
     71  '2'
     72 );
     73 assert.sameValue(
     74  C[x] = '2',
     75  '2'
     76 );
     77 assert.sameValue(
     78  c[String(x)],
     79  '2'
     80 );
     81 assert.sameValue(
     82  c[String(x)] = '2',
     83  '2'
     84 );
     85 
     86 assert.sameValue(
     87  C[String(x)],
     88  '2'
     89 );
     90 assert.sameValue(
     91  C[String(x)] = '2',
     92  '2'
     93 );
     94 
     95 reportCompare(0, 0);