Skip to content

Commit

Permalink
Give MinusToken the same precedence as PlusToken for template express…
Browse files Browse the repository at this point in the history
…ions.

Fixes #1577
  • Loading branch information
Arnavion committed Jan 6, 2015
1 parent 8e2365b commit 33534be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 33534be

Please sign in to comment.