Commit d0e5df3e authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[parsing] Remove unnecessary "impl()->" from ExpressionClassifier ops

Also rename "Discard" for clarity.

Bug: v8:6092
Change-Id: I8c299ded920e794418e0619b6958fbef35dfda4e
Reviewed-on: https://chromium-review.googlesource.com/466591Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44389}
parent 510abe73
...@@ -1438,7 +1438,7 @@ class ParserBase { ...@@ -1438,7 +1438,7 @@ class ParserBase {
// Pops and discards the classifier that is on top of the stack // Pops and discards the classifier that is on top of the stack
// without accumulating. // without accumulating.
V8_INLINE void Discard() { V8_INLINE void DiscardExpressionClassifier() {
DCHECK_NOT_NULL(classifier_); DCHECK_NOT_NULL(classifier_);
classifier_->Discard(); classifier_->Discard();
classifier_ = classifier_->previous(); classifier_ = classifier_->previous();
...@@ -1924,7 +1924,7 @@ ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) { ...@@ -1924,7 +1924,7 @@ ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) {
} }
// No need to accumulate binding pattern-related errors, since // No need to accumulate binding pattern-related errors, since
// an Expression can't be a binding pattern anyway. // an Expression can't be a binding pattern anyway.
impl()->AccumulateNonBindingPatternErrors(); AccumulateNonBindingPatternErrors();
if (!impl()->IsIdentifier(right)) classifier()->RecordNonSimpleParameter(); if (!impl()->IsIdentifier(right)) classifier()->RecordNonSimpleParameter();
if (impl()->IsEmptyExpression(result)) { if (impl()->IsEmptyExpression(result)) {
// First time through the loop. // First time through the loop.
...@@ -2139,7 +2139,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName( ...@@ -2139,7 +2139,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName(
ExpressionClassifier computed_name_classifier(this); ExpressionClassifier computed_name_classifier(this);
expression = ParseAssignmentExpression(true, CHECK_OK); expression = ParseAssignmentExpression(true, CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
Expect(Token::RBRACK, CHECK_OK); Expect(Token::RBRACK, CHECK_OK);
break; break;
} }
...@@ -2482,7 +2482,7 @@ ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker, ...@@ -2482,7 +2482,7 @@ ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker,
ExpressionT rhs = ParseAssignmentExpression( ExpressionT rhs = ParseAssignmentExpression(
true, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); true, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs, value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs,
kNoSourcePosition); kNoSourcePosition);
classifier()->RecordExpressionError( classifier()->RecordExpressionError(
...@@ -2777,7 +2777,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) { ...@@ -2777,7 +2777,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
classifier()->RecordDuplicateFormalParameterError(duplicate_loc); classifier()->RecordDuplicateFormalParameterError(duplicate_loc);
} }
expression = ParseArrowFunctionLiteral(accept_IN, parameters, CHECK_OK); expression = ParseArrowFunctionLiteral(accept_IN, parameters, CHECK_OK);
impl()->Discard(); DiscardExpressionClassifier();
classifier()->RecordPatternError(arrow_loc, classifier()->RecordPatternError(arrow_loc,
MessageTemplate::kUnexpectedToken, MessageTemplate::kUnexpectedToken,
Token::String(Token::ARROW)); Token::String(Token::ARROW));
...@@ -2813,11 +2813,11 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) { ...@@ -2813,11 +2813,11 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
if (!Token::IsAssignmentOp(peek())) { if (!Token::IsAssignmentOp(peek())) {
// Parsed conditional expression only (no assignment). // Parsed conditional expression only (no assignment).
// Pending non-pattern expressions must be merged. // Pending non-pattern expressions must be merged.
impl()->Accumulate(productions); Accumulate(productions);
return expression; return expression;
} else { } else {
// Pending non-pattern expressions must be discarded. // Pending non-pattern expressions must be discarded.
impl()->Accumulate(productions, false); Accumulate(productions, false);
} }
if (is_destructuring_assignment) { if (is_destructuring_assignment) {
...@@ -2842,7 +2842,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) { ...@@ -2842,7 +2842,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
// We try to estimate the set of properties set by constructors. We define a // We try to estimate the set of properties set by constructors. We define a
// new property whenever there is an assignment to a property of 'this'. We // new property whenever there is an assignment to a property of 'this'. We
...@@ -2967,7 +2967,7 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, ...@@ -2967,7 +2967,7 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN,
// expressions we always accept the 'in' keyword; see ECMA-262, // expressions we always accept the 'in' keyword; see ECMA-262,
// section 11.12, page 58. // section 11.12, page 58.
left = ParseAssignmentExpression(true, CHECK_OK); left = ParseAssignmentExpression(true, CHECK_OK);
impl()->AccumulateNonBindingPatternErrors(); AccumulateNonBindingPatternErrors();
} }
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
Expect(Token::COLON, CHECK_OK); Expect(Token::COLON, CHECK_OK);
...@@ -2975,7 +2975,7 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, ...@@ -2975,7 +2975,7 @@ ParserBase<Impl>::ParseConditionalExpression(bool accept_IN,
{ {
ExpressionClassifier classifier(this); ExpressionClassifier classifier(this);
right = ParseAssignmentExpression(accept_IN, CHECK_OK); right = ParseAssignmentExpression(accept_IN, CHECK_OK);
impl()->AccumulateNonBindingPatternErrors(); AccumulateNonBindingPatternErrors();
} }
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
return factory()->NewConditional(expression, left, right, pos); return factory()->NewConditional(expression, left, right, pos);
...@@ -3217,7 +3217,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) { ...@@ -3217,7 +3217,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) {
// async () => ... // async () => ...
return factory()->NewEmptyParentheses(pos); return factory()->NewEmptyParentheses(pos);
} else { } else {
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
} }
} else { } else {
args = ParseArguments(&spread_pos, false, CHECK_OK); args = ParseArguments(&spread_pos, false, CHECK_OK);
...@@ -3591,7 +3591,7 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters, ...@@ -3591,7 +3591,7 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters,
impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void)); impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void));
ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void)); ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void));
parameters->is_simple = false; parameters->is_simple = false;
impl()->Discard(); DiscardExpressionClassifier();
classifier()->RecordNonSimpleParameter(); classifier()->RecordNonSimpleParameter();
impl()->SetFunctionNameFromIdentifierRef(initializer, pattern); impl()->SetFunctionNameFromIdentifierRef(initializer, pattern);
...@@ -4334,7 +4334,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4334,7 +4334,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
ExpressionClassifier extends_classifier(this); ExpressionClassifier extends_classifier(this);
class_info.extends = ParseLeftHandSideExpression(CHECK_OK); class_info.extends = ParseLeftHandSideExpression(CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
} }
ClassLiteralChecker checker(this); ClassLiteralChecker checker(this);
...@@ -4363,7 +4363,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4363,7 +4363,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
} }
is_constructor &= class_info.has_seen_constructor; is_constructor &= class_info.has_seen_constructor;
impl()->RewriteNonPattern(CHECK_OK); impl()->RewriteNonPattern(CHECK_OK);
impl()->AccumulateFormalParameterContainmentErrors(); AccumulateFormalParameterContainmentErrors();
impl()->DeclareClassProperty(name, property, property_kind, is_static, impl()->DeclareClassProperty(name, property, property_kind, is_static,
is_constructor, &class_info, CHECK_OK); is_constructor, &class_info, CHECK_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment