| 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/compiler-specific.h" |
| 8 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 9 #include "src/globals.h" | 10 #include "src/globals.h" |
| 10 #include "src/objects.h" | 11 #include "src/objects.h" |
| 11 #include "src/zone/zone.h" | 12 #include "src/zone/zone.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 class AstNodeFactory; | 17 class AstNodeFactory; |
| 17 class AstValueFactory; | 18 class AstValueFactory; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a | 56 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a |
| 56 // corresponding variable (though some are bound during parse time). Variable | 57 // corresponding variable (though some are bound during parse time). Variable |
| 57 // allocation binds each unresolved VariableProxy to one Variable and assigns | 58 // allocation binds each unresolved VariableProxy to one Variable and assigns |
| 58 // a location. Note that many VariableProxy nodes may refer to the same Java- | 59 // a location. Note that many VariableProxy nodes may refer to the same Java- |
| 59 // Script variable. | 60 // Script variable. |
| 60 | 61 |
| 61 // JS environments are represented in the parser using Scope, DeclarationScope | 62 // JS environments are represented in the parser using Scope, DeclarationScope |
| 62 // and ModuleScope. DeclarationScope is used for any scope that hosts 'var' | 63 // and ModuleScope. DeclarationScope is used for any scope that hosts 'var' |
| 63 // declarations. This includes script, module, eval, varblock, and function | 64 // declarations. This includes script, module, eval, varblock, and function |
| 64 // scope. ModuleScope further specializes DeclarationScope. | 65 // scope. ModuleScope further specializes DeclarationScope. |
| 65 class Scope: public ZoneObject { | 66 class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { |
| 66 public: | 67 public: |
| 67 // --------------------------------------------------------------------------- | 68 // --------------------------------------------------------------------------- |
| 68 // Construction | 69 // Construction |
| 69 | 70 |
| 70 Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type); | 71 Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type); |
| 71 | 72 |
| 72 #ifdef DEBUG | 73 #ifdef DEBUG |
| 73 // The scope name is only used for printing/debugging. | 74 // The scope name is only used for printing/debugging. |
| 74 void SetScopeName(const AstRawString* scope_name) { | 75 void SetScopeName(const AstRawString* scope_name) { |
| 75 scope_name_ = scope_name; | 76 scope_name_ = scope_name; |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 void AllocateModuleVariables(); | 877 void AllocateModuleVariables(); |
| 877 | 878 |
| 878 private: | 879 private: |
| 879 ModuleDescriptor* module_descriptor_; | 880 ModuleDescriptor* module_descriptor_; |
| 880 }; | 881 }; |
| 881 | 882 |
| 882 } // namespace internal | 883 } // namespace internal |
| 883 } // namespace v8 | 884 } // namespace v8 |
| 884 | 885 |
| 885 #endif // V8_AST_SCOPES_H_ | 886 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |