@@ -326,7 +326,7 @@ namespace ts {
326326 // Assignment for bindingTarget = value.propName should highlight whole property, hence use p as source map node
327327 const propAccess = createDestructuringPropertyAccess ( value , propName ) ;
328328 if ( isComputedPropertyName ( propName ) ) {
329- ( computedTempVariables = computedTempVariables || [ ] ) . push ( ( propAccess as ElementAccessExpression ) . argumentExpression ) ;
329+ computedTempVariables = append ( computedTempVariables , ( propAccess as ElementAccessExpression ) . argumentExpression ) ;
330330 }
331331 emitDestructuringAssignment ( bindingTarget , propAccess , p ) ;
332332 }
@@ -428,18 +428,11 @@ namespace ts {
428428 }
429429 if ( isComputedPropertyName ( getPropertyName ( element ) ) ) {
430430 // get the temp name and put that in there instead, like `_tmp + ""`
431- const stringifiedTemp = < StringLiteral > createSynthesizedNode ( SyntaxKind . StringLiteral ) ;
432- stringifiedTemp . pos = location . pos ;
433- stringifiedTemp . end = location . end ;
434- stringifiedTemp . text = "" ;
435- propertyNames . push ( createBinary ( computedTempVariables . shift ( ) , SyntaxKind . PlusToken , stringifiedTemp ) ) ;
431+ propertyNames . push ( createBinary ( computedTempVariables . shift ( ) , SyntaxKind . PlusToken , createLiteral ( "" ) ) ) ;
436432 }
437433 else {
438- const str = < StringLiteral > createSynthesizedNode ( SyntaxKind . StringLiteral ) ;
439- str . pos = location . pos ;
440- str . end = location . end ;
441- str . text = getTextOfPropertyName ( getPropertyName ( element ) ) ;
442- propertyNames . push ( str ) ;
434+ const propName = getTextOfPropertyName ( getPropertyName ( element ) ) ;
435+ propertyNames . push ( createLiteral ( propName , location ) ) ;
443436 }
444437 }
445438 const args = createSynthesizedNodeArray ( [ value , createArrayLiteral ( propertyNames , location ) ] ) ;
@@ -569,11 +562,10 @@ namespace ts {
569562 bindingElements = [ ] ;
570563 }
571564 // Rewrite element to a declaration with an initializer that fetches property
572- // TODO: Probably save the result of createDestructuringPropertyAccess if propName is a computed property
573565 const propName = element . propertyName || < Identifier > element . name ;
574566 const propAccess = createDestructuringPropertyAccess ( value , propName ) ;
575567 if ( isComputedPropertyName ( propName ) ) {
576- ( computedTempVariables = computedTempVariables || [ ] ) . push ( ( propAccess as ElementAccessExpression ) . argumentExpression ) ;
568+ computedTempVariables = append ( computedTempVariables , ( propAccess as ElementAccessExpression ) . argumentExpression ) ;
577569 }
578570 emitBindingElement ( element , propAccess ) ;
579571 }
0 commit comments