Emit parens for tag of tagged template if necessary

This commit is contained in:
Ivo Gabe de Wolff
2015-02-13 18:34:32 +01:00
parent 8e16e1d010
commit f77bedd6f6
5 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -2189,7 +2189,7 @@ module ts {
}
write("], ");
emit(node.tag);
emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag));
write("(");
emit(tempVariable);
@@ -2475,7 +2475,7 @@ module ts {
emit((<SpreadElementExpression>node).expression);
}
function needsParenthesisForPropertyAccess(node: Expression) {
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
switch (node.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.ArrayLiteralExpression:
@@ -2517,7 +2517,7 @@ module ts {
var e = elements[pos];
if (e.kind === SyntaxKind.SpreadElementExpression) {
e = (<SpreadElementExpression>e).expression;
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccess(e));
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
pos++;
}
else {