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

Unified Diff: src/parsing/parser.cc

Issue 2301923002: ParserBase: Simplify FuncNameInferrer handling. (Closed)
Patch Set: code review (nikolaos@) Created 4 years, 3 months 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/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 9f18790eefce3cc4ff1a4637f29cd039e5b84262..18d6d69ae43c6a2388813f69c3c7302efc069ca5 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1779,7 +1779,8 @@ Statement* Parser::ParseHoistableDeclaration(
}
FuncNameInferrer::State fni_state(fni_);
- if (fni_ != NULL) fni_->PushEnclosingName(name);
+ DCHECK_NOT_NULL(fni_);
+ fni_->PushEnclosingName(name);
FunctionLiteral* fun = ParseFunctionLiteral(
name, scanner()->location(), name_validity,
is_generator ? FunctionKind::kGeneratorFunction
@@ -3905,7 +3906,10 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
if (should_be_used_once_hint)
function_literal->set_should_be_used_once_hint();
- if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
+ if (should_infer_name) {
+ DCHECK_NOT_NULL(fni_);
+ fni_->AddFunction(function_literal);
+ }
return function_literal;
}
@@ -4568,7 +4572,8 @@ Expression* Parser::ParseClassLiteral(const AstRawString* name,
properties->Add(property, zone());
}
- if (fni_ != nullptr) fni_->Infer();
+ DCHECK_NOT_NULL(fni_);
+ fni_->Infer();
if (property_name != ast_value_factory()->constructor_string()) {
SetFunctionNameFromPropertyName(property, property_name);
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698