cpn-obj-lit-computed-property-name-from-identifier.js (831B)
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/object-literal.template 4 /*--- 5 description: Computed property name from string literal (ComputedPropertyName in ObjectLiteral) 6 esid: prod-ComputedPropertyName 7 features: [computed-property-names] 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 = 1; 26 27 28 29 let o = { 30 [x]: '2' 31 }; 32 33 assert.sameValue( 34 o[x], 35 '2' 36 ); 37 assert.sameValue( 38 o[String(x)], 39 '2' 40 ); 41 42 reportCompare(0, 0);