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/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/globals.h" |
10 #include "src/pending-compilation-error-handler.h" | 11 #include "src/pending-compilation-error-handler.h" |
11 #include "src/zone.h" | 12 #include "src/zone.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 class ParseInfo; | 17 class ParseInfo; |
17 | 18 |
18 // A hash map to support fast variable declaration and lookup. | 19 // A hash map to support fast variable declaration and lookup. |
19 class VariableMap: public ZoneHashMap { | 20 class VariableMap: public ZoneHashMap { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Declare an implicit global variable in this scope which must be a | 168 // Declare an implicit global variable in this scope which must be a |
168 // script scope. The variable was introduced (possibly from an inner | 169 // script scope. The variable was introduced (possibly from an inner |
169 // scope) by a reference to an unresolved variable with no intervening | 170 // scope) by a reference to an unresolved variable with no intervening |
170 // with statements or eval calls. | 171 // with statements or eval calls. |
171 Variable* DeclareDynamicGlobal(const AstRawString* name); | 172 Variable* DeclareDynamicGlobal(const AstRawString* name); |
172 | 173 |
173 // Create a new unresolved variable. | 174 // Create a new unresolved variable. |
174 VariableProxy* NewUnresolved(AstNodeFactory* factory, | 175 VariableProxy* NewUnresolved(AstNodeFactory* factory, |
175 const AstRawString* name, | 176 const AstRawString* name, |
176 Variable::Kind kind = Variable::NORMAL, | 177 Variable::Kind kind = Variable::NORMAL, |
177 int start_position = RelocInfo::kNoPosition, | 178 int start_position = kNoSourcePosition, |
178 int end_position = RelocInfo::kNoPosition) { | 179 int end_position = kNoSourcePosition) { |
179 // Note that we must not share the unresolved variables with | 180 // Note that we must not share the unresolved variables with |
180 // the same name because they may be removed selectively via | 181 // the same name because they may be removed selectively via |
181 // RemoveUnresolved(). | 182 // RemoveUnresolved(). |
182 DCHECK(!already_resolved()); | 183 DCHECK(!already_resolved()); |
183 VariableProxy* proxy = | 184 VariableProxy* proxy = |
184 factory->NewVariableProxy(name, kind, start_position, end_position); | 185 factory->NewVariableProxy(name, kind, start_position, end_position); |
185 unresolved_.Add(proxy, zone_); | 186 unresolved_.Add(proxy, zone_); |
186 return proxy; | 187 return proxy; |
187 } | 188 } |
188 | 189 |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 AstValueFactory* ast_value_factory_; | 814 AstValueFactory* ast_value_factory_; |
814 Zone* zone_; | 815 Zone* zone_; |
815 | 816 |
816 PendingCompilationErrorHandler pending_error_handler_; | 817 PendingCompilationErrorHandler pending_error_handler_; |
817 }; | 818 }; |
818 | 819 |
819 } // namespace internal | 820 } // namespace internal |
820 } // namespace v8 | 821 } // namespace v8 |
821 | 822 |
822 #endif // V8_AST_SCOPES_H_ | 823 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |