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/globals.h" |
(...skipping 313 matching lines...) Loading... |
324 | 324 |
325 // inner_scope() and sibling() together implement the inner scope list of a | 325 // inner_scope() and sibling() together implement the inner scope list of a |
326 // scope. Inner scope points to the an inner scope of the function, and | 326 // scope. Inner scope points to the an inner scope of the function, and |
327 // "sibling" points to a next inner scope of the outer scope of this scope. | 327 // "sibling" points to a next inner scope of the outer scope of this scope. |
328 Scope* inner_scope() const { return inner_scope_; } | 328 Scope* inner_scope() const { return inner_scope_; } |
329 Scope* sibling() const { return sibling_; } | 329 Scope* sibling() const { return sibling_; } |
330 | 330 |
331 // The scope immediately surrounding this scope, or NULL. | 331 // The scope immediately surrounding this scope, or NULL. |
332 Scope* outer_scope() const { return outer_scope_; } | 332 Scope* outer_scope() const { return outer_scope_; } |
333 | 333 |
| 334 // The innermost outer scope that needs a context or nullptr. |
| 335 Scope* GetOuterScopeWithContext() const; |
| 336 |
334 const AstRawString* catch_variable_name() const { | 337 const AstRawString* catch_variable_name() const { |
335 DCHECK(is_catch_scope()); | 338 DCHECK(is_catch_scope()); |
336 DCHECK_EQ(1, num_var()); | 339 DCHECK_EQ(1, num_var()); |
337 return static_cast<AstRawString*>(variables_.Start()->key); | 340 return static_cast<AstRawString*>(variables_.Start()->key); |
338 } | 341 } |
339 | 342 |
340 // --------------------------------------------------------------------------- | 343 // --------------------------------------------------------------------------- |
341 // Variable allocation. | 344 // Variable allocation. |
342 | 345 |
343 // Collect variables in this scope. Note that the function variable - if | 346 // Collect variables in this scope. Note that the function variable - if |
(...skipping 504 matching lines...) Loading... |
848 void AllocateModuleVariables(); | 851 void AllocateModuleVariables(); |
849 | 852 |
850 private: | 853 private: |
851 ModuleDescriptor* module_descriptor_; | 854 ModuleDescriptor* module_descriptor_; |
852 }; | 855 }; |
853 | 856 |
854 } // namespace internal | 857 } // namespace internal |
855 } // namespace v8 | 858 } // namespace v8 |
856 | 859 |
857 #endif // V8_AST_SCOPES_H_ | 860 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |