Emit parens when an argument is a comma operator

Example:
foo`A${ 1 }B${ 2, 3 }C`;
This commit is contained in:
Ivo Gabe de Wolff 2015-01-05 20:30:38 +01:00
parent 69d724f554
commit 8f28c95b04

View file

@ -2079,7 +2079,9 @@ module ts {
// Now we emit the expressions
forEach(node.templateSpans, templateSpan => {
write(", ");
emit(templateSpan.expression);
var needsParens = templateSpan.expression.kind === SyntaxKind.BinaryExpression
&& (<BinaryExpression> templateSpan.expression).operator === SyntaxKind.CommaToken;
emitParenthesized(templateSpan.expression, needsParens);
});
return;
}