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

Unified Diff: src/parsing/parser.cc

Issue 2372373002: Remove getters that duplicate FunctionKind in SharedFunctionInfo and ParseInfo (Closed)
Patch Set: Remove SharedFunctionInfo::is_resumable and FunctionState stuff 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/parse-info.cc ('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 0fcc9ead7287f675cd5d19931fe8dcfddf032d0c..eb2a76f7ef20a974b90138c7c6a170c0f225749b 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -940,11 +940,11 @@ FunctionLiteral* Parser::DoParseLazy(ParseInfo* info,
DCHECK(is_sloppy(outer->language_mode()) ||
is_strict(info->language_mode()));
FunctionLiteral::FunctionType function_type = ComputeFunctionType(info);
+ FunctionKind kind = info->function_kind();
bool ok = true;
- if (info->is_arrow()) {
- bool is_async = allow_harmony_async_await() && info->is_async();
- if (is_async) {
+ if (IsArrowFunction(kind)) {
+ if (allow_harmony_async_await() && IsAsyncFunction(kind)) {
DCHECK(!scanner()->HasAnyLineTerminatorAfterNext());
if (!Check(Token::ASYNC)) {
CHECK(stack_overflow());
@@ -957,8 +957,7 @@ FunctionLiteral* Parser::DoParseLazy(ParseInfo* info,
}
// TODO(adamk): We should construct this scope from the ScopeInfo.
- FunctionKind arrow_kind = is_async ? kAsyncArrowFunction : kArrowFunction;
- DeclarationScope* scope = NewFunctionScope(arrow_kind);
+ DeclarationScope* scope = NewFunctionScope(kind);
// These two bits only need to be explicitly set because we're
// not passing the ScopeInfo to the Scope constructor.
@@ -1011,10 +1010,9 @@ FunctionLiteral* Parser::DoParseLazy(ParseInfo* info,
}
}
}
- } else if (info->is_default_constructor()) {
+ } else if (IsDefaultConstructor(kind)) {
DCHECK_EQ(scope(), outer);
- bool is_subclass_constructor =
- IsSubclassConstructor(info->function_kind());
+ bool is_subclass_constructor = IsSubclassConstructor(kind);
result = DefaultConstructor(
raw_name, is_subclass_constructor, info->requires_class_field_init(),
info->start_position(), info->end_position(), info->language_mode());
@@ -1031,10 +1029,9 @@ FunctionLiteral* Parser::DoParseLazy(ParseInfo* info,
result = SynthesizeClassFieldInitializer(shared_info->length());
}
} else {
- result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(),
- kSkipFunctionNameCheck,
- info->function_kind(), kNoSourcePosition,
- function_type, info->language_mode(), &ok);
+ result = ParseFunctionLiteral(
+ raw_name, Scanner::Location::invalid(), kSkipFunctionNameCheck, kind,
+ kNoSourcePosition, function_type, info->language_mode(), &ok);
if (info->requires_class_field_init()) {
result = InsertClassFieldInitializer(result);
}
« no previous file with comments | « src/parsing/parse-info.cc ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698