tor-browser

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

cpn-class-decl-computed-property-name-from-identifier.js (1170B)


      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-declaration.template
      4 /*---
      5 description: Computed property name from string literal (ComputedPropertyName in ClassDeclaration)
      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 class C {
     41  [x]() {
     42    return '2';
     43  }
     44  static [x]() {
     45    return '2';
     46  }
     47 };
     48 
     49 let c = new C();
     50 
     51 assert.sameValue(
     52  c[x](),
     53  '2'
     54 );
     55 assert.sameValue(
     56  C[x](),
     57  '2'
     58 );
     59 assert.sameValue(
     60  c[String(x)](),
     61  '2'
     62 );
     63 assert.sameValue(
     64  C[String(x)](),
     65  '2'
     66 );
     67 
     68 reportCompare(0, 0);