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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 } | 616 } |
617 | 617 |
618 bool asm_module() const { return asm_module_; } | 618 bool asm_module() const { return asm_module_; } |
619 void set_asm_module() { asm_module_ = true; } | 619 void set_asm_module() { asm_module_ = true; } |
620 bool asm_function() const { return asm_function_; } | 620 bool asm_function() const { return asm_function_; } |
621 void set_asm_function() { asm_module_ = true; } | 621 void set_asm_function() { asm_module_ = true; } |
622 | 622 |
623 void DeclareThis(AstValueFactory* ast_value_factory); | 623 void DeclareThis(AstValueFactory* ast_value_factory); |
624 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); | 624 void DeclareDefaultFunctionVariables(AstValueFactory* ast_value_factory); |
625 | 625 |
626 // This lookup corresponds to a lookup in the "intermediate" scope sitting | |
627 // between this scope and the outer scope. (ECMA-262, 3rd., requires that | |
628 // the name of named function literal is kept in an intermediate scope | |
629 // in between this scope and the next outer scope.) | |
630 Variable* LookupFunctionVar(const AstRawString* name); | |
631 | |
632 // Declare the function variable for a function literal. This variable | 626 // Declare the function variable for a function literal. This variable |
633 // is in an intermediate scope between this function scope and the the | 627 // is in an intermediate scope between this function scope and the the |
634 // outer scope. Only possible for function scopes; at most one variable. | 628 // outer scope. Only possible for function scopes; at most one variable. |
| 629 // |
| 630 // This function needs to be called after all other variables have been |
| 631 // declared in the scope. It will possibly add a variable for {name} to |
| 632 // {variables_}; either the function variable itself, or a non-local in case |
| 633 // the function calls sloppy eval. |
635 Variable* DeclareFunctionVar(const AstRawString* name); | 634 Variable* DeclareFunctionVar(const AstRawString* name); |
636 | 635 |
637 // Declare a parameter in this scope. When there are duplicated | 636 // Declare a parameter in this scope. When there are duplicated |
638 // parameters the rightmost one 'wins'. However, the implementation | 637 // parameters the rightmost one 'wins'. However, the implementation |
639 // expects all parameters to be declared and from left to right. | 638 // expects all parameters to be declared and from left to right. |
640 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, | 639 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, |
641 bool is_optional, bool is_rest, bool* is_duplicate, | 640 bool is_optional, bool is_rest, bool* is_duplicate, |
642 AstValueFactory* ast_value_factory); | 641 AstValueFactory* ast_value_factory); |
643 | 642 |
644 // Declare an implicit global variable in this scope which must be a | 643 // Declare an implicit global variable in this scope which must be a |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 void AllocateModuleVariables(); | 861 void AllocateModuleVariables(); |
863 | 862 |
864 private: | 863 private: |
865 ModuleDescriptor* module_descriptor_; | 864 ModuleDescriptor* module_descriptor_; |
866 }; | 865 }; |
867 | 866 |
868 } // namespace internal | 867 } // namespace internal |
869 } // namespace v8 | 868 } // namespace v8 |
870 | 869 |
871 #endif // V8_AST_SCOPES_H_ | 870 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |