mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 01:33:15 -05:00
Fixed emit for parenthesized template expressions.
This commit is contained in:
@@ -817,8 +817,11 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
var templateNeedsParens = isExpression(node.parent) &&
|
||||
comparePrecedenceToBinaryPlus(node.parent) !== Comparison.LessThan;
|
||||
Debug.assert(node.parent.kind !== SyntaxKind.TaggedTemplateExpression);
|
||||
|
||||
var templateNeedsParens = isExpression(node.parent)
|
||||
&& node.parent.kind !== SyntaxKind.ParenExpression
|
||||
&& comparePrecedenceToBinaryPlus(node.parent) !== Comparison.LessThan;
|
||||
|
||||
if (templateNeedsParens) {
|
||||
write("(");
|
||||
@@ -836,7 +839,8 @@ module ts {
|
||||
// ("abc" + 1) << (2 + "")
|
||||
// rather than
|
||||
// "abc" + (1 << 2) + ""
|
||||
var needsParens = comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan;
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenExpression
|
||||
&& comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan;
|
||||
|
||||
write(" + ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user