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

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
« 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 f61e43073cfcf25a988e51ad3183e5bf1d91f6ca..bce3c030eb772ca6947d0384feb8c0651938d047 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -533,6 +533,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) {
@@ -1140,6 +1147,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);
« 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