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

Unified Diff: src/parser.cc

Issue 1534533002: Version 4.8.271.10 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.8
Patch Set: Bump patch level 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
« no previous file with comments | « src/func-name-inferrer.h ('k') | src/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 9227272e09ca51ed62dce91704ad6e940b7723e5..2704db3d7c712a300280ed71959e31e0b850acae 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2242,10 +2242,8 @@ Statement* Parser::ParseFunctionDeclaration(
const AstRawString* name = ParseIdentifierOrStrictReservedWord(
&is_strict_reserved, CHECK_OK);
- if (fni_ != NULL) {
- fni_->Enter();
- fni_->PushEnclosingName(name);
- }
+ FuncNameInferrer::State fni_state(fni_);
+ if (fni_ != NULL) fni_->PushEnclosingName(name);
FunctionLiteral* fun = ParseFunctionLiteral(
name, scanner()->location(),
is_strict_reserved ? kFunctionNameIsStrictReserved
@@ -2254,7 +2252,6 @@ Statement* Parser::ParseFunctionDeclaration(
: FunctionKind::kNormalFunction,
pos, FunctionLiteral::DECLARATION, FunctionLiteral::NORMAL_ARITY,
language_mode(), CHECK_OK);
- if (fni_ != NULL) fni_->Leave();
// Even if we're not at the top-level of the global or a function
// scope, we treat it as such and introduce the function with its
@@ -2531,7 +2528,7 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
int bindings_start = peek_position();
bool is_for_iteration_variable;
do {
- if (fni_ != NULL) fni_->Enter();
+ FuncNameInferrer::State fni_state(fni_);
// Parse name.
if (!first_declaration) Consume(Token::COMMA);
@@ -2621,7 +2618,6 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
value = GetLiteralUndefined(position());
}
- if (single_name && fni_ != NULL) fni_->Leave();
parsing_result->declarations.Add(DeclarationParsingResult::Declaration(
pattern, initializer_position, value));
first_declaration = false;
@@ -4933,7 +4929,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
const bool has_extends = extends != nullptr;
while (peek() != Token::RBRACE) {
if (Check(Token::SEMICOLON)) continue;
- if (fni_ != NULL) fni_->Enter();
+ FuncNameInferrer::State fni_state(fni_);
const bool in_class = true;
const bool is_static = false;
bool is_computed_name = false; // Classes do not care about computed
@@ -4951,10 +4947,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
properties->Add(property, zone());
}
- if (fni_ != NULL) {
- fni_->Infer();
- fni_->Leave();
- }
+ if (fni_ != NULL) fni_->Infer();
}
Expect(Token::RBRACE, CHECK_OK);
« no previous file with comments | « src/func-name-inferrer.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698