Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index aa83969e99977ac61b9e12adc5427a74ff8c0851..4947790395f3c431db7ef1ef68f30d47fccb8e5b 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -3204,6 +3204,13 @@ Expression* Parser::ParseUnaryExpression(bool* ok) { |
factory()->NewNumberLiteral(-1), |
position); |
} |
+ // ...and one more time for '~foo' => 'foo^(~0)'. |
+ if (op == Token::BIT_NOT) { |
+ return factory()->NewBinaryOperation(Token::BIT_XOR, |
+ expression, |
+ factory()->NewNumberLiteral(~0), |
+ position); |
+ } |
return factory()->NewUnaryOperation(op, expression, position); |