mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-19 12:45:58 -05:00
Emit parens when an argument is a comma operator
Example:
foo`A${ 1 }B${ 2, 3 }C`;
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user