File tree 2 files changed +8
-4
lines changed
tests/baselines/reference
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -817,8 +817,11 @@ module ts {
817
817
return ;
818
818
}
819
819
820
- var templateNeedsParens = isExpression ( node . parent ) &&
821
- comparePrecedenceToBinaryPlus ( node . parent ) !== Comparison . LessThan ;
820
+ Debug . assert ( node . parent . kind !== SyntaxKind . TaggedTemplateExpression ) ;
821
+
822
+ var templateNeedsParens = isExpression ( node . parent )
823
+ && node . parent . kind !== SyntaxKind . ParenExpression
824
+ && comparePrecedenceToBinaryPlus ( node . parent ) !== Comparison . LessThan ;
822
825
823
826
if ( templateNeedsParens ) {
824
827
write ( "(" ) ;
@@ -836,7 +839,8 @@ module ts {
836
839
// ("abc" + 1) << (2 + "")
837
840
// rather than
838
841
// "abc" + (1 << 2) + ""
839
- var needsParens = comparePrecedenceToBinaryPlus ( templateSpan . expression ) !== Comparison . GreaterThan ;
842
+ var needsParens = templateSpan . expression . kind !== SyntaxKind . ParenExpression
843
+ && comparePrecedenceToBinaryPlus ( templateSpan . expression ) !== Comparison . GreaterThan ;
840
844
841
845
write ( " + " ) ;
842
846
Original file line number Diff line number Diff line change 2
2
var x = ( `abc${ 0 } abc` ) ;
3
3
4
4
//// [templateStringInParentheses.js]
5
- var x = ( ( "abc" + 0 + "abc" ) ) ;
5
+ var x = ( "abc" + 0 + "abc" ) ;
You can’t perform that action at this time.
0 commit comments