| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 630 |
| 631 bool asm_module() const { return asm_module_; } | 631 bool asm_module() const { return asm_module_; } |
| 632 void set_asm_module(); | 632 void set_asm_module(); |
| 633 bool asm_function() const { return asm_function_; } | 633 bool asm_function() const { return asm_function_; } |
| 634 void set_asm_function() { asm_module_ = true; } | 634 void set_asm_function() { asm_module_ = true; } |
| 635 | 635 |
| 636 void DeclareThis(AstValueFactory* ast_value_factory); | 636 void DeclareThis(AstValueFactory* ast_value_factory); |
| 637 void DeclareArguments(AstValueFactory* ast_value_factory); | 637 void DeclareArguments(AstValueFactory* ast_value_factory); |
| 638 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); | 638 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); |
| 639 | 639 |
| 640 // This lookup corresponds to a lookup in the "intermediate" scope sitting | |
| 641 // between this scope and the outer scope. (ECMA-262, 3rd., requires that | |
| 642 // the name of named function literal is kept in an intermediate scope | |
| 643 // in between this scope and the next outer scope.) | |
| 644 Variable* LookupFunctionVar(const AstRawString* name); | |
| 645 | |
| 646 // Declare the function variable for a function literal. This variable | 640 // Declare the function variable for a function literal. This variable |
| 647 // is in an intermediate scope between this function scope and the the | 641 // is in an intermediate scope between this function scope and the the |
| 648 // outer scope. Only possible for function scopes; at most one variable. | 642 // outer scope. Only possible for function scopes; at most one variable. |
| 643 // |
| 644 // This function needs to be called after all other variables have been |
| 645 // declared in the scope. It will add a variable for {name} to {variables_}; |
| 646 // either the function variable itself, or a non-local in case the function |
| 647 // calls sloppy eval. |
| 649 Variable* DeclareFunctionVar(const AstRawString* name); | 648 Variable* DeclareFunctionVar(const AstRawString* name); |
| 650 | 649 |
| 651 // Declare a parameter in this scope. When there are duplicated | 650 // Declare a parameter in this scope. When there are duplicated |
| 652 // parameters the rightmost one 'wins'. However, the implementation | 651 // parameters the rightmost one 'wins'. However, the implementation |
| 653 // expects all parameters to be declared and from left to right. | 652 // expects all parameters to be declared and from left to right. |
| 654 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, | 653 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, |
| 655 bool is_optional, bool is_rest, bool* is_duplicate, | 654 bool is_optional, bool is_rest, bool* is_duplicate, |
| 656 AstValueFactory* ast_value_factory); | 655 AstValueFactory* ast_value_factory); |
| 657 | 656 |
| 658 // Declare an implicit global variable in this scope which must be a | 657 // Declare an implicit global variable in this scope which must be a |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 void AllocateModuleVariables(); | 871 void AllocateModuleVariables(); |
| 873 | 872 |
| 874 private: | 873 private: |
| 875 ModuleDescriptor* module_descriptor_; | 874 ModuleDescriptor* module_descriptor_; |
| 876 }; | 875 }; |
| 877 | 876 |
| 878 } // namespace internal | 877 } // namespace internal |
| 879 } // namespace v8 | 878 } // namespace v8 |
| 880 | 879 |
| 881 #endif // V8_AST_SCOPES_H_ | 880 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |