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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 // Create a non-local variable with a given name. | 518 // Create a non-local variable with a given name. |
519 // These variables are looked up dynamically at runtime. | 519 // These variables are looked up dynamically at runtime. |
520 Variable* NonLocal(const AstRawString* name, VariableMode mode); | 520 Variable* NonLocal(const AstRawString* name, VariableMode mode); |
521 | 521 |
522 // Variable resolution. | 522 // Variable resolution. |
523 // Lookup a variable reference given by name recursively starting with this | 523 // Lookup a variable reference given by name recursively starting with this |
524 // scope, and stopping when reaching the outer_scope_end scope. If the code is | 524 // scope, and stopping when reaching the outer_scope_end scope. If the code is |
525 // executed because of a call to 'eval', the context parameter should be set | 525 // executed because of a call to 'eval', the context parameter should be set |
526 // to the calling context of 'eval'. | 526 // to the calling context of 'eval'. |
527 // {declare_free} indicates whether nullptr should be returned for free | 527 Variable* LookupRecursive(VariableProxy* proxy, Scope* outer_scope_end); |
528 // variables when falling off outer_scope_end, or whether they should be | |
529 // declared automatically as non-locals. | |
530 Variable* LookupRecursive(VariableProxy* proxy, bool declare_free, | |
531 Scope* outer_scope_end); | |
532 void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var); | 528 void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var); |
533 void ResolveVariable(ParseInfo* info, VariableProxy* proxy); | 529 void ResolveVariable(ParseInfo* info, VariableProxy* proxy); |
534 void ResolveVariablesRecursively(ParseInfo* info); | 530 void ResolveVariablesRecursively(ParseInfo* info); |
535 | 531 |
536 // Finds free variables of this scope. This mutates the unresolved variables | 532 // Finds free variables of this scope. This mutates the unresolved variables |
537 // list along the way, so full resolution cannot be done afterwards. | 533 // list along the way, so full resolution cannot be done afterwards. |
538 // If a ParseInfo* is passed, non-free variables will be resolved. | 534 // If a ParseInfo* is passed, non-free variables will be resolved. |
539 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, | 535 VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, |
540 ParseInfo* info = nullptr, | 536 ParseInfo* info = nullptr, |
541 VariableProxy* stack = nullptr); | 537 VariableProxy* stack = nullptr); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 void AllocateModuleVariables(); | 868 void AllocateModuleVariables(); |
873 | 869 |
874 private: | 870 private: |
875 ModuleDescriptor* module_descriptor_; | 871 ModuleDescriptor* module_descriptor_; |
876 }; | 872 }; |
877 | 873 |
878 } // namespace internal | 874 } // namespace internal |
879 } // namespace v8 | 875 } // namespace v8 |
880 | 876 |
881 #endif // V8_AST_SCOPES_H_ | 877 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |