| 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);
|
|
|