| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/ast/scopeinfo.h" | 8 #include "src/ast/scopeinfo.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 current_scope = with_scope; | 220 current_scope = with_scope; |
| 221 // All the inner scopes are inside a with. | 221 // All the inner scopes are inside a with. |
| 222 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) { | 222 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) { |
| 223 s->scope_inside_with_ = true; | 223 s->scope_inside_with_ = true; |
| 224 } | 224 } |
| 225 } else if (context->IsScriptContext()) { | 225 } else if (context->IsScriptContext()) { |
| 226 ScopeInfo* scope_info = context->scope_info(); | 226 ScopeInfo* scope_info = context->scope_info(); |
| 227 current_scope = new (zone) Scope(zone, current_scope, SCRIPT_SCOPE, | 227 current_scope = new (zone) Scope(zone, current_scope, SCRIPT_SCOPE, |
| 228 Handle<ScopeInfo>(scope_info), | 228 Handle<ScopeInfo>(scope_info), |
| 229 script_scope->ast_value_factory_); | 229 script_scope->ast_value_factory_); |
| 230 } else if (context->IsModuleContext()) { | |
| 231 ScopeInfo* scope_info = context->module()->scope_info(); | |
| 232 current_scope = new (zone) Scope(zone, current_scope, MODULE_SCOPE, | |
| 233 Handle<ScopeInfo>(scope_info), | |
| 234 script_scope->ast_value_factory_); | |
| 235 } else if (context->IsFunctionContext()) { | 230 } else if (context->IsFunctionContext()) { |
| 236 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); | 231 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); |
| 237 current_scope = new (zone) Scope(zone, current_scope, FUNCTION_SCOPE, | 232 current_scope = new (zone) Scope(zone, current_scope, FUNCTION_SCOPE, |
| 238 Handle<ScopeInfo>(scope_info), | 233 Handle<ScopeInfo>(scope_info), |
| 239 script_scope->ast_value_factory_); | 234 script_scope->ast_value_factory_); |
| 240 if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true; | 235 if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true; |
| 241 if (scope_info->IsAsmModule()) current_scope->asm_module_ = true; | 236 if (scope_info->IsAsmModule()) current_scope->asm_module_ = true; |
| 242 } else if (context->IsBlockContext()) { | 237 } else if (context->IsBlockContext()) { |
| 243 ScopeInfo* scope_info = context->scope_info(); | 238 ScopeInfo* scope_info = context->scope_info(); |
| 244 current_scope = new (zone) | 239 current_scope = new (zone) |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1512 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
| 1518 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1513 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
| 1519 (is_function_var_in_context ? 1 : 0); | 1514 (is_function_var_in_context ? 1 : 0); |
| 1520 } | 1515 } |
| 1521 | 1516 |
| 1522 | 1517 |
| 1523 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1518 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
| 1524 | 1519 |
| 1525 } // namespace internal | 1520 } // namespace internal |
| 1526 } // namespace v8 | 1521 } // namespace v8 |
| OLD | NEW |