Permalink
Browse files

Ported rev. b084b31 from esprima

Fix order of operations for `^` and `|` operators
  • Loading branch information...
1 parent d662118 commit b8392c0028d71007f41c86e2e7b3426591430d57 @rinon rinon committed Aug 6, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/esprima.js
View
@@ -1984,14 +1984,14 @@
return expr;
}
- function parseBitwiseORExpression() {
+ function parseBitwiseXORExpression() {
var expr = parseBitwiseANDExpression();
- while (match('|')) {
+ while (match('^')) {
lex();
expr = {
type: Syntax.BinaryExpression,
- operator: '|',
+ operator: '^',
left: expr,
right: parseBitwiseANDExpression()
};
@@ -2000,16 +2000,16 @@
return expr;
}
- function parseBitwiseXORExpression() {
- var expr = parseBitwiseORExpression();
+ function parseBitwiseORExpression() {
+ var expr = parseBitwiseXORExpression();
- while (match('^')) {
+ while (match('|')) {
lex();
expr = {
type: Syntax.BinaryExpression,
- operator: '^',
+ operator: '|',
left: expr,
- right: parseBitwiseORExpression()
+ right: parseBitwiseXORExpression()
};
}

0 comments on commit b8392c0

Please sign in to comment.