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

Unified Diff: src/ast/scopes.cc

Issue 2294193003: Unify DeclarationScope::Analyze (Closed)
Patch Set: Created 4 years, 4 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/ast/scopes.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index bc26f1da9ac7984cbf1c05be61e9dbe0698e9f24..bbc8155e9bd3f5f54070d480170f6ed4faef91cc 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -399,7 +399,7 @@ int Scope::num_parameters() const {
return is_declaration_scope() ? AsDeclarationScope()->num_parameters() : 0;
}
-void DeclarationScope::Analyze(ParseInfo* info) {
+void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
DCHECK(info->literal() != NULL);
DeclarationScope* scope = info->literal()->scope();
@@ -411,7 +411,7 @@ void DeclarationScope::Analyze(ParseInfo* info) {
scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
scope->outer_scope()->already_resolved_);
- scope->AllocateVariables(info, false /* for_debugger */);
+ scope->AllocateVariables(info, mode);
#ifdef DEBUG
if (info->script_is_native() ? FLAG_print_builtin_scopes
@@ -423,21 +423,6 @@ void DeclarationScope::Analyze(ParseInfo* info) {
#endif
}
-void DeclarationScope::AnalyzeForDebugger(ParseInfo* info) {
- DCHECK(info->literal() != NULL);
- DeclarationScope* scope = info->literal()->scope();
-
- // We are compiling one of three cases:
- // 1) top-level code,
- // 2) a function/eval/module on the top-level
- // 3) a function/eval in a scope that was already resolved.
- DCHECK(scope->scope_type() == SCRIPT_SCOPE ||
- scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
- scope->outer_scope()->already_resolved_);
-
- scope->AllocateVariables(info, true /* for_debugger */);
-}
-
void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) {
DCHECK(!already_resolved_);
DCHECK(is_declaration_scope());
@@ -892,11 +877,11 @@ Declaration* Scope::CheckLexDeclarationsConflictingWith(
return nullptr;
}
-void DeclarationScope::AllocateVariables(ParseInfo* info, bool for_debugger) {
+void DeclarationScope::AllocateVariables(ParseInfo* info, AnalyzeMode mode) {
PropagateScopeInfo();
ResolveVariablesRecursively(info);
AllocateVariablesRecursively();
- AllocateScopeInfosRecursively(info->isolate(), for_debugger);
+ AllocateScopeInfosRecursively(info->isolate(), mode);
}
bool Scope::AllowsLazyParsing() const {
@@ -1643,15 +1628,15 @@ void Scope::AllocateVariablesRecursively() {
DCHECK(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
}
-void Scope::AllocateScopeInfosRecursively(Isolate* isolate, bool for_debugger) {
+void Scope::AllocateScopeInfosRecursively(Isolate* isolate, AnalyzeMode mode) {
DCHECK(scope_info_.is_null());
- if (for_debugger || NeedsScopeInfo()) {
+ if (mode == AnalyzeMode::kDebugger || NeedsScopeInfo()) {
scope_info_ = ScopeInfo::Create(isolate, zone(), this);
}
// Allocate ScopeInfos for inner scopes.
for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
- scope->AllocateScopeInfosRecursively(isolate, for_debugger);
+ scope->AllocateScopeInfosRecursively(isolate, mode);
}
}
« no previous file with comments | « src/ast/scopes.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698