Give MinusToken the same precedence as PlusToken for template expressions.

Fixes #1577
This commit is contained in:
Arnavion 2015-01-06 02:42:02 -08:00
parent 8e2365b4cc
commit 33534be268

View File

@ -2117,7 +2117,8 @@ module ts {
* or equal precedence to the binary '+' operator
*/
function comparePrecedenceToBinaryPlus(expression: Expression): Comparison {
// All binary expressions have lower precedence than '+' apart from '*', '/', and '%'.
// All binary expressions have lower precedence than '+' apart from '*', '/', and '%'
// which have greater precedence and '-' which has equal precedence.
// All unary operators have a higher precedence apart from yield.
// Arrow functions and conditionals have a lower precedence,
// although we convert the former into regular function expressions in ES5 mode,
@ -2134,6 +2135,7 @@ module ts {
case SyntaxKind.PercentToken:
return Comparison.GreaterThan;
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
return Comparison.EqualTo;
default:
return Comparison.LessThan;