mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Fixed emit for parenthesized template expressions.
This commit is contained in:
parent
64097a3c6c
commit
aabfebd40e
@ -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(" + ");
|
||||
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
var x = (`abc${0}abc`);
|
||||
|
||||
//// [templateStringInParentheses.js]
|
||||
var x = (("abc" + 0 + "abc"));
|
||||
var x = ("abc" + 0 + "abc");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user