Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 8171f9433a4627c9b8fe5f1c5ac6a72d73a9ae4a..fa0fa90511338f38deb49067917f6ce6a45b9f41 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -117,7 +117,9 @@ class ParserBase : public Traits { |
bool allow_harmony_rest_params() const { |
return allow_harmony_rest_params_; |
} |
- |
+ bool allow_harmony_exponentiation() const { |
+ return scanner()->HarmonyExponentiation(); |
+ } |
bool allow_strong_mode() const { return allow_strong_mode_; } |
// Setters that determine whether certain syntactical constructs are |
@@ -157,6 +159,9 @@ class ParserBase : public Traits { |
void set_allow_harmony_rest_params(bool allow) { |
allow_harmony_rest_params_ = allow; |
} |
+ void set_allow_harmony_exponentiation(bool allow) { |
+ scanner()->SetHarmonyExponentiation(allow); |
+ } |
void set_allow_strong_mode(bool allow) { allow_strong_mode_ = allow; } |
protected: |
@@ -2460,7 +2465,15 @@ ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, bool* ok) { |
Token::Value op = Next(); |
Scanner::Location op_location = scanner()->location(); |
int pos = position(); |
- ExpressionT y = ParseBinaryExpression(prec1 + 1, accept_IN, CHECK_OK); |
+ ExpressionT y = Traits::EmptyExpression(); |
+ |
+ if (op != Token::EXP) { |
+ // Left-to-right associativity |
+ y = ParseBinaryExpression(prec1 + 1, accept_IN, CHECK_OK); |
+ } else { |
+ // Right-to-left associativity |
+ y = ParseBinaryExpression(prec1, accept_IN, CHECK_OK); |
+ } |
if (this->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos, |
factory())) { |