Commit 06d4d1e8 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Use scope instead of explicit discarding of classifier

Change-Id: I8f5da41d11df5fce7df4f7757717fb165a6043d9
Reviewed-on: https://chromium-review.googlesource.com/c/1288391Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56760}
parent 779d102c
...@@ -222,9 +222,7 @@ class ExpressionClassifierErrorTracker ...@@ -222,9 +222,7 @@ class ExpressionClassifierErrorTracker
reported_errors_begin_ = reported_errors_end_ = reported_errors_->length(); reported_errors_begin_ = reported_errors_end_ = reported_errors_->length();
} }
~ExpressionClassifierErrorTracker() override { Discard(); } ~ExpressionClassifierErrorTracker() override {
V8_INLINE void Discard() {
if (reported_errors_end_ == reported_errors_->length()) { if (reported_errors_end_ == reported_errors_->length()) {
reported_errors_->Rewind(reported_errors_begin_); reported_errors_->Rewind(reported_errors_begin_);
reported_errors_end_ = reported_errors_begin_; reported_errors_end_ = reported_errors_begin_;
...@@ -365,8 +363,6 @@ class ExpressionClassifierEmptyErrorTracker ...@@ -365,8 +363,6 @@ class ExpressionClassifierEmptyErrorTracker
explicit ExpressionClassifierEmptyErrorTracker(typename Types::Base* base) explicit ExpressionClassifierEmptyErrorTracker(typename Types::Base* base)
: BaseClassType(base) {} : BaseClassType(base) {}
V8_INLINE void Discard() {}
protected: protected:
V8_INLINE const Error& reported_error(ErrorKind kind) const { V8_INLINE const Error& reported_error(ErrorKind kind) const {
static Error none; static Error none;
......
...@@ -1461,14 +1461,6 @@ class ParserBase { ...@@ -1461,14 +1461,6 @@ class ParserBase {
ExpressionClassifier::LetPatternProduction)); ExpressionClassifier::LetPatternProduction));
} }
// Pops and discards the classifier that is on top of the stack
// without accumulating.
V8_INLINE void DiscardExpressionClassifier() {
DCHECK_NOT_NULL(classifier_);
classifier_->Discard();
classifier_ = classifier_->previous();
}
// 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:
...@@ -3650,14 +3642,14 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters, ...@@ -3650,14 +3642,14 @@ void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters,
*ok = false; *ok = false;
return; return;
} }
ExpressionClassifier init_classifier(this); {
initializer = ParseAssignmentExpression(true, CHECK_OK_CUSTOM(Void)); ExpressionClassifier init_classifier(this);
ValidateExpression(CHECK_OK_CUSTOM(Void)); initializer = ParseAssignmentExpression(true, CHECK_OK_CUSTOM(Void));
ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void)); ValidateExpression(CHECK_OK_CUSTOM(Void));
parameters->is_simple = false; ValidateFormalParameterInitializer(CHECK_OK_CUSTOM(Void));
DiscardExpressionClassifier(); parameters->is_simple = false;
}
classifier()->RecordNonSimpleParameter(); classifier()->RecordNonSimpleParameter();
impl()->SetFunctionNameFromIdentifierRef(initializer, pattern); impl()->SetFunctionNameFromIdentifierRef(initializer, pattern);
} }
......
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