From 8f28c95b041ba8cf46e3da93973a95552ae83248 Mon Sep 17 00:00:00 2001 From: Ivo Gabe de Wolff Date: Mon, 5 Jan 2015 20:30:38 +0100 Subject: [PATCH] Emit parens when an argument is a comma operator Example: foo`A${ 1 }B${ 2, 3 }C`; --- src/compiler/emitter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 602e4ccc12c..f3e4cefa919 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -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 + && ( templateSpan.expression).operator === SyntaxKind.CommaToken; + emitParenthesized(templateSpan.expression, needsParens); }); return; }