@@ -2508,20 +2508,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
25082508 }
25092509
25102510 /**
2511- * Emit exponentiation operator down-level using Math.pow
2511+ * Emit ES7 exponentiation operator downlevel using Math.pow
25122512 * @param node {BinaryExpression} a binary expression node containing exponentiationOperator (**, **=)
25132513 */
25142514 function emitExponentiationOperator ( node : BinaryExpression ) {
25152515 let leftHandSideExpression = node . left ;
25162516 if ( node . operatorToken . kind === SyntaxKind . AsteriskAsteriskEqualsToken ) {
25172517 let synthesizedLHS : ElementAccessExpression | PropertyAccessExpression ;
25182518 // TODO (yuisu) : comment
2519- let shouldEmitParenthesis = node . parent . kind === SyntaxKind . VariableDeclaration || node . parent . kind === SyntaxKind . BinaryExpression ;
2519+ let shouldEmitParenthesis = false ;
25202520
25212521 if ( isElementAccessExpression ( leftHandSideExpression ) ) {
2522+ shouldEmitParenthesis = node . parent . kind === SyntaxKind . VariableDeclaration || node . parent . kind === SyntaxKind . BinaryExpression ;
2523+
25222524 if ( shouldEmitParenthesis ) {
25232525 write ( "(" ) ;
25242526 }
2527+
25252528 synthesizedLHS = < ElementAccessExpression > createSynthesizedNode ( SyntaxKind . ElementAccessExpression , /*startsOnNewLine*/ false ) ;
25262529 let tempExpression = createAndRecordTempVariable ( TempFlags . Auto ) ;
25272530 emitAssignment ( tempExpression , leftHandSideExpression . expression , /*shouldEmitCommaBeforeAssignment*/ false ) ;
@@ -2539,9 +2542,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
25392542 write ( ", " ) ;
25402543 }
25412544 else if ( isPropertyAccessExpression ( leftHandSideExpression ) ) {
2545+ shouldEmitParenthesis = node . parent . kind === SyntaxKind . VariableDeclaration || node . parent . kind === SyntaxKind . BinaryExpression ;
2546+
25422547 if ( shouldEmitParenthesis ) {
25432548 write ( "(" ) ;
25442549 }
2550+
25452551 synthesizedLHS = < PropertyAccessExpression > createSynthesizedNode ( SyntaxKind . PropertyAccessExpression , /*startsOnNewLine*/ false ) ;
25462552 let tempExpression = createAndRecordTempVariable ( TempFlags . Auto ) ;
25472553 synthesizedLHS . expression = tempExpression
0 commit comments