Chromium Code Reviews| Index: src/ast/scopes.cc |
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
| index 09bb6d4e0507e488e5d853b2341718d33b553ead..a11689f67a6a261717f4d8011a6a4173a46e6deb 100644 |
| --- a/src/ast/scopes.cc |
| +++ b/src/ast/scopes.cc |
| @@ -376,21 +376,19 @@ int Scope::num_parameters() const { |
| void Scope::Analyze(ParseInfo* info) { |
| DCHECK(info->literal() != NULL); |
| DeclarationScope* scope = info->literal()->scope(); |
| - DeclarationScope* top = scope; |
| - // Traverse the scope tree up to the first unresolved scope or the global |
| - // scope and start scope resolution and variable allocation from that scope. |
| - // Such a scope is always a closure-scope, so always skip to the next closure |
| - // scope. |
| - while (!top->is_script_scope() && |
| - !top->outer_scope()->already_resolved()) { |
| - top = top->outer_scope()->GetClosureScope(); |
| - } |
| + // 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. |
|
bradnelson
2016/08/07 03:05:24
You can also be compiling the text of an Asm.js mo
|
| + DCHECK(scope->scope_type() == SCRIPT_SCOPE || |
| + scope->outer_scope()->scope_type() == SCRIPT_SCOPE || |
| + scope->outer_scope()->already_resolved()); |
| // Allocate the variables. |
| { |
| AstNodeFactory ast_node_factory(info->ast_value_factory()); |
| - top->AllocateVariables(info, &ast_node_factory); |
| + scope->AllocateVariables(info, &ast_node_factory); |
| } |
| #ifdef DEBUG |