Commit ae9a15fe authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Remove some unneeded expression classifiers

If we're verifying/accumulating/throwing all possible classifier errors anyway,
we don't need our own classifier.

Change-Id: Ibfbdc4e5151190385598fc50bda9f9921b6aedce
Reviewed-on: https://chromium-review.googlesource.com/c/1348080
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57751}
parent 5bacc5aa
...@@ -1330,12 +1330,6 @@ class ParserBase { ...@@ -1330,12 +1330,6 @@ class ParserBase {
bool previous_accept_IN_; bool previous_accept_IN_;
}; };
V8_INLINE void AccumulateNonBindingPatternErrors() {
this->Accumulate(ExpressionClassifier::AllProductions &
~(ExpressionClassifier::BindingPatternProduction |
ExpressionClassifier::LetPatternProduction));
}
// Accumulate errors that can be arbitrarily deep in an expression. // Accumulate errors that can be arbitrarily deep in an expression.
// These correspond to the ECMAScript spec's 'Contains' operation // These correspond to the ECMAScript spec's 'Contains' operation
// on productions. This includes: // on productions. This includes:
...@@ -2559,10 +2553,10 @@ void ParserBase<Impl>::ParseArguments( ...@@ -2559,10 +2553,10 @@ void ParserBase<Impl>::ParseArguments(
ExpressionT argument = ParseAssignmentExpression(); ExpressionT argument = ParseAssignmentExpression();
if (maybe_arrow) { if (maybe_arrow) {
if (!impl()->IsIdentifier(argument)) { if (!impl()->IsIdentifier(argument)) {
classifier()->previous()->RecordNonSimpleParameter(); classifier()->RecordNonSimpleParameter();
} }
if (is_spread) { if (is_spread) {
classifier()->previous()->RecordNonSimpleParameter(); classifier()->RecordNonSimpleParameter();
if (argument->IsAssignment()) { if (argument->IsAssignment()) {
classifier()->RecordAsyncArrowFormalParametersError( classifier()->RecordAsyncArrowFormalParametersError(
scanner()->location(), MessageTemplate::kRestDefaultInitializer); scanner()->location(), MessageTemplate::kRestDefaultInitializer);
...@@ -2833,8 +2827,6 @@ ParserBase<Impl>::ParseConditionalContinuation(ExpressionT expression, ...@@ -2833,8 +2827,6 @@ ParserBase<Impl>::ParseConditionalContinuation(ExpressionT expression,
SourceRange then_range, else_range; SourceRange then_range, else_range;
BindingPatternUnexpectedToken(); BindingPatternUnexpectedToken();
ExpressionClassifier classifier(this);
ExpressionT left; ExpressionT left;
{ {
SourceRangeScope range_scope(scanner(), &then_range); SourceRangeScope range_scope(scanner(), &then_range);
...@@ -2853,7 +2845,6 @@ ParserBase<Impl>::ParseConditionalContinuation(ExpressionT expression, ...@@ -2853,7 +2845,6 @@ ParserBase<Impl>::ParseConditionalContinuation(ExpressionT expression,
} }
ExpressionT expr = factory()->NewConditional(expression, left, right, pos); ExpressionT expr = factory()->NewConditional(expression, left, right, pos);
impl()->RecordConditionalSourceRange(expr, then_range, else_range); impl()->RecordConditionalSourceRange(expr, then_range, else_range);
AccumulateNonBindingPatternErrors();
return expr; return expr;
} }
...@@ -3079,8 +3070,6 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) { ...@@ -3079,8 +3070,6 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) {
scanner()->current_token() == Token::ASYNC && scanner()->current_token() == Token::ASYNC &&
!scanner()->HasLineTerminatorBeforeNext())) { !scanner()->HasLineTerminatorBeforeNext())) {
DCHECK(impl()->IsAsync(impl()->AsIdentifier(result))); DCHECK(impl()->IsAsync(impl()->AsIdentifier(result)));
ExpressionClassifier async_classifier(this);
Scanner::Location lparen_loc = scanner()->peek_location(); Scanner::Location lparen_loc = scanner()->peek_location();
int pos = position(); int pos = position();
...@@ -3106,7 +3095,6 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) { ...@@ -3106,7 +3095,6 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) {
} }
} }
ValidateExpression(); ValidateExpression();
AccumulateFormalParameterContainmentErrors();
classifier()->RecordPatternError(lparen_loc, classifier()->RecordPatternError(lparen_loc,
MessageTemplate::kUnexpectedToken, MessageTemplate::kUnexpectedToken,
...@@ -4227,10 +4215,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4227,10 +4215,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
scope()->set_start_position(end_position()); scope()->set_start_position(end_position());
if (Check(Token::EXTENDS)) { if (Check(Token::EXTENDS)) {
FuncNameInferrerState fni_state(&fni_); FuncNameInferrerState fni_state(&fni_);
ExpressionClassifier extends_classifier(this);
class_info.extends = ParseLeftHandSideExpression(); class_info.extends = ParseLeftHandSideExpression();
ValidateExpression(); ValidateExpression();
AccumulateFormalParameterContainmentErrors();
} }
Expect(Token::LBRACE); Expect(Token::LBRACE);
...@@ -4244,7 +4230,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4244,7 +4230,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
bool is_static; bool is_static;
bool is_private = false; bool is_private = false;
ClassLiteralProperty::Kind property_kind; ClassLiteralProperty::Kind property_kind;
ExpressionClassifier property_classifier(this);
IdentifierT property_name; IdentifierT property_name;
// If we haven't seen the constructor yet, it potentially is the next // If we haven't seen the constructor yet, it potentially is the next
// property. // property.
...@@ -4262,7 +4247,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4262,7 +4247,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
} }
is_constructor &= class_info.has_seen_constructor; is_constructor &= class_info.has_seen_constructor;
ValidateExpression(); ValidateExpression();
AccumulateFormalParameterContainmentErrors();
if (has_error()) return impl()->FailureExpression(); if (has_error()) return impl()->FailureExpression();
impl()->DeclareClassProperty(name, property, property_name, property_kind, impl()->DeclareClassProperty(name, property, property_name, property_kind,
...@@ -4481,7 +4465,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic() { ...@@ -4481,7 +4465,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic() {
Consume(Token::MOD); Consume(Token::MOD);
// Allow "eval" or "arguments" for backward compatibility. // Allow "eval" or "arguments" for backward compatibility.
IdentifierT name = ParseIdentifier(kAllowRestrictedIdentifiers); IdentifierT name = ParseIdentifier(kAllowRestrictedIdentifiers);
ExpressionClassifier classifier(this);
if (peek() != Token::LPAREN) { if (peek() != Token::LPAREN) {
impl()->ReportUnexpectedToken(peek()); impl()->ReportUnexpectedToken(peek());
return impl()->FailureExpression(); return impl()->FailureExpression();
......
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