Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: src/parsing/parser-base.h

Issue 1507283003: Fix FuncNameInferrer usage in ParseAssignmentExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a basic RAII object and skip turbofan Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index c56b59e99c71cda3e1efa1ffc29241a160ca7ab2..581015f5c9b88196869e988a16165481d66d3139 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1847,7 +1847,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
Expect(Token::LBRACE, CHECK_OK);
while (peek() != Token::RBRACE) {
- if (fni_ != nullptr) fni_->Enter();
+ FuncNameInferrer::State fni_state(fni_);
const bool in_class = false;
const bool is_static = false;
@@ -1878,10 +1878,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseObjectLiteral(
Expect(Token::COMMA, CHECK_OK);
}
- if (fni_ != nullptr) {
- fni_->Infer();
- fni_->Leave();
- }
+ if (fni_ != nullptr) fni_->Infer();
}
Expect(Token::RBRACE, CHECK_OK);
@@ -1984,7 +1981,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
return this->ParseYieldExpression(classifier, ok);
}
- if (fni_ != NULL) fni_->Enter();
+ FuncNameInferrer::State fni_state(fni_);
ParserBase<Traits>::Checkpoint checkpoint(this);
ExpressionClassifier arrow_formals_classifier(classifier->duplicate_finder());
bool parenthesized_formals = peek() == Token::LPAREN;
@@ -2028,6 +2025,9 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
Scanner::Location(lhs_beg_pos, scanner()->location().end_pos),
MessageTemplate::kInvalidDestructuringTarget);
}
+
+ if (fni_ != nullptr) fni_->Infer();
+
return expression;
}
@@ -2049,7 +2049,6 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
// allow_harmony_destructuring_bind() && maybe_pattern && !is_rhs;
if (!Token::IsAssignmentOp(peek())) {
- if (fni_ != NULL) fni_->Leave();
// Parsed conditional expression only (no assignment).
if (is_pattern_element && !this->IsValidReferenceExpression(expression) &&
!maybe_pattern) {
@@ -2125,7 +2124,6 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, int flags,
} else {
fni_->RemoveLastFunction();
}
- fni_->Leave();
}
ExpressionT result = factory()->NewAssignment(op, expression, right, pos);
@@ -2604,7 +2602,7 @@ ParserBase<Traits>::ParseStrongInitializationExpression(
// 'this' '.' IdentifierName '=' AssignmentExpression
// 'this' '[' Expression ']' '=' AssignmentExpression
- if (fni_ != NULL) fni_->Enter();
+ FuncNameInferrer::State fni_state(fni_);
Consume(Token::THIS);
int pos = position();
@@ -2663,7 +2661,6 @@ ParserBase<Traits>::ParseStrongInitializationExpression(
} else {
fni_->RemoveLastFunction();
}
- fni_->Leave();
}
if (function_state_->return_location().IsValid()) {
« src/parsing/parser.cc ('K') | « src/parsing/parser.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698