Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index c14fb9b20cdc067c3f37b86938138aa648b73daa..d38aaaaa26e7f1fa3876c041b708d123c054660a 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -123,6 +123,9 @@ class ParserBase : public Traits { |
bool allow_harmony_destructuring() const { |
return allow_harmony_destructuring_; |
} |
+ bool allow_harmony_spread_arrays() const { |
+ return allow_harmony_spread_arrays_; |
+ } |
bool allow_strong_mode() const { return allow_strong_mode_; } |
@@ -161,7 +164,9 @@ class ParserBase : public Traits { |
void set_allow_harmony_destructuring(bool allow) { |
allow_harmony_destructuring_ = allow; |
} |
- |
+ void set_allow_harmony_spread_arrays(bool allow) { |
+ allow_harmony_spread_arrays_ = allow; |
+ } |
protected: |
enum AllowRestrictedIdentifiers { |
@@ -1011,6 +1016,7 @@ class ParserBase : public Traits { |
bool allow_harmony_rest_params_; |
bool allow_harmony_spreadcalls_; |
bool allow_harmony_destructuring_; |
+ bool allow_harmony_spread_arrays_; |
bool allow_strong_mode_; |
}; |
@@ -2508,12 +2514,13 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseArrayLiteral( |
} |
elem = this->GetLiteralTheHole(peek_position(), factory()); |
} else if (peek() == Token::ELLIPSIS) { |
- ExpressionUnexpectedToken(classifier); |
+ if (!allow_harmony_spread_arrays()) { |
+ ExpressionUnexpectedToken(classifier); |
+ } |
int start_pos = peek_position(); |
Consume(Token::ELLIPSIS); |
ExpressionT argument = |
this->ParseAssignmentExpression(true, classifier, CHECK_OK); |
- |
elem = factory()->NewSpread(argument, start_pos); |
seen_spread = true; |
} else { |