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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // * A 'with' statement has been encountered and there is no variable | 564 // * A 'with' statement has been encountered and there is no variable |
565 // binding for the name between the variable reference and the 'with'. | 565 // binding for the name between the variable reference and the 'with'. |
566 // The variable potentially references a property of the 'with' object. | 566 // The variable potentially references a property of the 'with' object. |
567 // * The code is being executed as part of a call to 'eval' and the calling | 567 // * The code is being executed as part of a call to 'eval' and the calling |
568 // context chain contains either a variable binding for the name or it | 568 // context chain contains either a variable binding for the name or it |
569 // contains a 'with' context. | 569 // contains a 'with' context. |
570 DYNAMIC_LOOKUP | 570 DYNAMIC_LOOKUP |
571 }; | 571 }; |
572 | 572 |
573 // Lookup a variable reference given by name recursively starting with this | 573 // Lookup a variable reference given by name recursively starting with this |
574 // scope, but only until max_outer_scope (if not nullptr). If the code is | 574 // scope, and stopping when reaching the outer_scope_end scope. If the code is |
575 // executed because of a call to 'eval', the context parameter should be set | 575 // executed because of a call to 'eval', the context parameter should be set |
576 // to the calling context of 'eval'. | 576 // to the calling context of 'eval'. |
577 Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind, | 577 Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind, |
578 AstNodeFactory* factory, | 578 AstNodeFactory* factory, |
579 Scope* max_outer_scope = nullptr); | 579 Scope* outer_scope_end = nullptr); |
580 void ResolveTo(ParseInfo* info, BindingKind binding_kind, | 580 void ResolveTo(ParseInfo* info, BindingKind binding_kind, |
581 VariableProxy* proxy, Variable* var); | 581 VariableProxy* proxy, Variable* var); |
582 void ResolveVariable(ParseInfo* info, VariableProxy* proxy, | 582 void ResolveVariable(ParseInfo* info, VariableProxy* proxy, |
583 AstNodeFactory* factory); | 583 AstNodeFactory* factory); |
584 void ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory); | 584 void ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory); |
585 | 585 |
586 // Finds free variables of this scope. This mutates the unresolved variables | 586 // Finds free variables of this scope. This mutates the unresolved variables |
587 // list along the way, so full resolution cannot be done afterwards. | 587 // list along the way, so full resolution cannot be done afterwards. |
588 // If a ParseInfo* is passed, non-free variables will be resolved. | 588 // If a ParseInfo* is passed, non-free variables will be resolved. |
589 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, | 589 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 // Convenience variable; Subclass constructor only | 890 // Convenience variable; Subclass constructor only |
891 Variable* this_function_; | 891 Variable* this_function_; |
892 // Module descriptor; module scopes only. | 892 // Module descriptor; module scopes only. |
893 ModuleDescriptor* module_descriptor_; | 893 ModuleDescriptor* module_descriptor_; |
894 }; | 894 }; |
895 | 895 |
896 } // namespace internal | 896 } // namespace internal |
897 } // namespace v8 | 897 } // namespace v8 |
898 | 898 |
899 #endif // V8_AST_SCOPES_H_ | 899 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |