| Index: src/parsing/parser-base.h
|
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
|
| index d54a4bb1bdb7b78e7a9fd5a521491d4fec76a7de..83e11ee0cbc5bc1fdd47a5eaf040a0582a09eda1 100644
|
| --- a/src/parsing/parser-base.h
|
| +++ b/src/parsing/parser-base.h
|
| @@ -728,8 +728,6 @@ class ParserBase : public Traits {
|
| ExpressionT ParseExpression(bool accept_IN, bool* ok);
|
| ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier,
|
| bool* ok);
|
| - ExpressionT ParseExpression(bool accept_IN, int flags,
|
| - ExpressionClassifier* classifier, bool* ok);
|
| ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok);
|
| ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set,
|
| bool* is_computed_name,
|
| @@ -744,12 +742,12 @@ class ParserBase : public Traits {
|
| bool* ok);
|
|
|
| enum AssignmentExpressionFlags {
|
| - kIsNormalAssignment = 0,
|
| - kIsPossiblePatternElement = 1 << 0,
|
| - kIsPossibleArrowFormals = 1 << 1
|
| + kIsNormalAssignment,
|
| + kIsPossiblePatternElement
|
| };
|
|
|
| - ExpressionT ParseAssignmentExpression(bool accept_IN, int flags,
|
| + ExpressionT ParseAssignmentExpression(bool accept_IN,
|
| + AssignmentExpressionFlags flags,
|
| ExpressionClassifier* classifier,
|
| bool* ok);
|
| ExpressionT ParseAssignmentExpression(bool accept_IN,
|
| @@ -1327,8 +1325,8 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
|
| MessageTemplate::kUnexpectedToken,
|
| Token::String(Token::ELLIPSIS));
|
| classifier->RecordNonSimpleParameter();
|
| - ExpressionT expr = this->ParseAssignmentExpression(
|
| - true, kIsPossibleArrowFormals, classifier, CHECK_OK);
|
| + ExpressionT expr =
|
| + this->ParseAssignmentExpression(true, classifier, CHECK_OK);
|
| if (!this->IsIdentifier(expr) && !expr->IsObjectLiteral() &&
|
| !expr->IsArrayLiteral()) {
|
| classifier->RecordArrowFormalParametersError(
|
| @@ -1347,8 +1345,7 @@ ParserBase<Traits>::ParsePrimaryExpression(ExpressionClassifier* classifier,
|
| // Heuristically try to detect immediately called functions before
|
| // seeing the call parentheses.
|
| parenthesized_function_ = (peek() == Token::FUNCTION);
|
| - ExpressionT expr = this->ParseExpression(true, kIsPossibleArrowFormals,
|
| - classifier, CHECK_OK);
|
| + ExpressionT expr = this->ParseExpression(true, classifier, CHECK_OK);
|
| Expect(Token::RPAREN, CHECK_OK);
|
| return expr;
|
| }
|
| @@ -1418,20 +1415,13 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
|
| template <class Traits>
|
| typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
|
| bool accept_IN, ExpressionClassifier* classifier, bool* ok) {
|
| - return ParseExpression(accept_IN, kIsNormalAssignment, classifier, ok);
|
| -}
|
| -
|
| -
|
| -template <class Traits>
|
| -typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
|
| - bool accept_IN, int flags, ExpressionClassifier* classifier, bool* ok) {
|
| // Expression ::
|
| // AssignmentExpression
|
| // Expression ',' AssignmentExpression
|
|
|
| ExpressionClassifier binding_classifier;
|
| - ExpressionT result = this->ParseAssignmentExpression(
|
| - accept_IN, flags, &binding_classifier, CHECK_OK);
|
| + ExpressionT result =
|
| + this->ParseAssignmentExpression(accept_IN, &binding_classifier, CHECK_OK);
|
| classifier->Accumulate(binding_classifier,
|
| ExpressionClassifier::AllProductions);
|
| bool is_simple_parameter_list = this->IsIdentifier(result);
|
| @@ -1456,7 +1446,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
|
| }
|
| int pos = position(), expr_pos = peek_position();
|
| ExpressionT right = this->ParseAssignmentExpression(
|
| - accept_IN, flags, &binding_classifier, CHECK_OK);
|
| + accept_IN, &binding_classifier, CHECK_OK);
|
| if (is_rest) {
|
| if (!this->IsIdentifier(right) && !right->IsObjectLiteral() &&
|
| !right->IsArrayLiteral()) {
|
| @@ -1935,7 +1925,8 @@ typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments(
|
| // Precedence = 2
|
| template <class Traits>
|
| typename ParserBase<Traits>::ExpressionT
|
| -ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
|
| +ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
|
| + AssignmentExpressionFlags flags,
|
| ExpressionClassifier* classifier,
|
| bool* ok) {
|
| // AssignmentExpression ::
|
| @@ -1943,8 +1934,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
|
| // ArrowFunction
|
| // YieldExpression
|
| // LeftHandSideExpression AssignmentOperator AssignmentExpression
|
| - bool maybe_pattern_element = flags & kIsPossiblePatternElement;
|
| - bool maybe_arrow_formals = flags & kIsPossibleArrowFormals;
|
| + bool maybe_pattern_element = flags == kIsPossiblePatternElement;
|
| bool is_destructuring_assignment = false;
|
| int lhs_beg_pos = peek_position();
|
|
|
| @@ -2032,7 +2022,10 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
|
| classifier->ForgiveCoverInitializedNameError();
|
| ValidateAssignmentPattern(classifier, CHECK_OK);
|
| is_destructuring_assignment = true;
|
| - } else if (maybe_arrow_formals) {
|
| + } else if (allow_harmony_default_parameters() &&
|
| + !allow_harmony_destructuring_assignment()) {
|
| + // TODO(adamk): This branch should be removed once the destructuring
|
| + // assignment and default parameter flags are removed.
|
| expression = this->ClassifyAndRewriteReferenceExpression(
|
| classifier, expression, lhs_beg_pos, scanner()->location().end_pos,
|
| MessageTemplate::kInvalidLhsInAssignment);
|
|
|