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 #ifndef V8_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
7 | 7 |
8 #include "src/base/hashmap.h" | 8 #include "src/base/hashmap.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 // This method should only be invoked on scopes created during parsing (i.e., | 438 // This method should only be invoked on scopes created during parsing (i.e., |
439 // not deserialized from a context). Also, since NeedsContext() is only | 439 // not deserialized from a context). Also, since NeedsContext() is only |
440 // returning a valid result after variables are resolved, NeedsScopeInfo() | 440 // returning a valid result after variables are resolved, NeedsScopeInfo() |
441 // should also be invoked after resolution. | 441 // should also be invoked after resolution. |
442 bool NeedsScopeInfo() const { | 442 bool NeedsScopeInfo() const { |
443 DCHECK(!already_resolved_); | 443 DCHECK(!already_resolved_); |
444 // A lazily parsed scope doesn't contain enough information to create a | 444 // A lazily parsed scope doesn't contain enough information to create a |
445 // ScopeInfo from it. | 445 // ScopeInfo from it. |
446 if (is_lazily_parsed_) return false; | 446 if (is_lazily_parsed_) return false; |
447 return NeedsContext() || is_script_scope() || is_function_scope() || | 447 // The debugger expects all functions to have scope infos. |
448 is_eval_scope() || is_module_scope(); | 448 // TODO(jochen|yangguo): Remove this requirement. |
| 449 if (is_function_scope()) return true; |
| 450 return NeedsContext(); |
449 } | 451 } |
450 | 452 |
451 Zone* zone_; | 453 Zone* zone_; |
452 | 454 |
453 // Scope tree. | 455 // Scope tree. |
454 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL | 456 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL |
455 Scope* inner_scope_; // an inner scope of this scope | 457 Scope* inner_scope_; // an inner scope of this scope |
456 Scope* sibling_; // a sibling inner scope of the outer scope of this scope. | 458 Scope* sibling_; // a sibling inner scope of the outer scope of this scope. |
457 | 459 |
458 // The variables declared in this scope: | 460 // The variables declared in this scope: |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 void AllocateModuleVariables(); | 875 void AllocateModuleVariables(); |
874 | 876 |
875 private: | 877 private: |
876 ModuleDescriptor* module_descriptor_; | 878 ModuleDescriptor* module_descriptor_; |
877 }; | 879 }; |
878 | 880 |
879 } // namespace internal | 881 } // namespace internal |
880 } // namespace v8 | 882 } // namespace v8 |
881 | 883 |
882 #endif // V8_AST_SCOPES_H_ | 884 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |