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

Unified Diff: src/ast/scopes.cc

Issue 2358503002: Change the CompilerDispatcherJob to take a SharedFunctionInfo (Closed)
Patch Set: updates 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
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 86f87b15f26d575f9929752c1625978f0f9db78a..c1da2b7d3651d91943772706750533f833274a6c 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -536,6 +536,13 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
scope->AllocateVariables(info, mode);
+ // Ensuring that the outer script scope has a scope info avoids having
+ // special case for native contexts vs other contexts.
+ if (info->script_scope()->scope_info_.is_null()) {
+ info->script_scope()->scope_info_ =
+ handle(ScopeInfo::Empty(info->isolate()));
+ }
+
#ifdef DEBUG
if (info->script_is_native() ? FLAG_print_builtin_scopes
: FLAG_print_scopes) {
@@ -1143,6 +1150,14 @@ DeclarationScope* Scope::GetReceiverScope() {
return scope->AsDeclarationScope();
}
+Scope* Scope::GetOuterScopeWithContext() {
+ Scope* scope = outer_scope_;
+ while (scope && !scope->NeedsContext()) {
+ scope = scope->outer_scope();
+ }
+ return scope;
+}
+
Handle<StringSet> DeclarationScope::CollectNonLocals(
ParseInfo* info, Handle<StringSet> non_locals) {
VariableProxy* free_variables = FetchFreeVariables(this, info);

Powered by Google App Engine
This is Rietveld 408576698