tor-browser

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

cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js (936B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case
      3 // - src/computed-property-names/evaluation/object-literal.template
      4 /*---
      5 description: Computed property name from assignment expression coalesce (ComputedPropertyName in ObjectLiteral)
      6 esid: prod-ComputedPropertyName
      7 features: [computed-property-names, logical-assignment-operators]
      8 flags: [generated]
      9 info: |
     10    ObjectLiteral:
     11      { PropertyDefinitionList }
     12 
     13    PropertyDefinitionList:
     14      PropertyDefinition
     15 
     16    PropertyDefinition:
     17      PropertyName: AssignmentExpression
     18 
     19    PropertyName:
     20      ComputedPropertyName
     21 
     22    ComputedPropertyName:
     23      [ AssignmentExpression ]
     24 ---*/
     25 let x = null;
     26 
     27 
     28 let o = {
     29  [x ??= 1]: 2
     30 };
     31 
     32 assert.sameValue(
     33  o[x ??= 1],
     34  2
     35 );
     36 assert.sameValue(
     37  o[String(x ??= 1)],
     38  2
     39 );
     40 
     41 assert.sameValue(x, 1);
     42 
     43 reportCompare(0, 0);