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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 // Remove a temporary variable. This is for adjusting the scope of | 812 // Remove a temporary variable. This is for adjusting the scope of |
813 // temporaries used when desugaring parameter initializers. | 813 // temporaries used when desugaring parameter initializers. |
814 // Returns the index at which it was found in this scope, or -1 if | 814 // Returns the index at which it was found in this scope, or -1 if |
815 // it was not found. | 815 // it was not found. |
816 int RemoveTemporary(Variable* var); | 816 int RemoveTemporary(Variable* var); |
817 | 817 |
818 // Adds a temporary variable in this scope's TemporaryScope. This is for | 818 // Adds a temporary variable in this scope's TemporaryScope. This is for |
819 // adjusting the scope of temporaries used when desugaring parameter | 819 // adjusting the scope of temporaries used when desugaring parameter |
820 // initializers. | 820 // initializers. |
821 void AddTemporary(Variable* var) { | 821 void AddTemporary(Variable* var) { |
| 822 DCHECK(!already_resolved()); |
822 // Temporaries are only placed in ClosureScopes. | 823 // Temporaries are only placed in ClosureScopes. |
823 DCHECK_EQ(GetClosureScope(), this); | 824 DCHECK_EQ(GetClosureScope(), this); |
824 temps_.Add(var, zone()); | 825 temps_.Add(var, zone()); |
825 } | 826 } |
826 | 827 |
827 ZoneList<Variable*>* temps() { return &temps_; } | 828 ZoneList<Variable*>* temps() { return &temps_; } |
828 | 829 |
829 void DeclareSloppyBlockFunction(const AstRawString* name, | 830 void DeclareSloppyBlockFunction(const AstRawString* name, |
830 SloppyBlockFunctionStatement* statement) { | 831 SloppyBlockFunctionStatement* statement) { |
831 sloppy_block_function_map_.Declare(zone(), name, statement); | 832 sloppy_block_function_map_.Declare(zone(), name, statement); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 // Convenience variable; Subclass constructor only | 898 // Convenience variable; Subclass constructor only |
898 Variable* this_function_; | 899 Variable* this_function_; |
899 // Module descriptor; module scopes only. | 900 // Module descriptor; module scopes only. |
900 ModuleDescriptor* module_descriptor_; | 901 ModuleDescriptor* module_descriptor_; |
901 }; | 902 }; |
902 | 903 |
903 } // namespace internal | 904 } // namespace internal |
904 } // namespace v8 | 905 } // namespace v8 |
905 | 906 |
906 #endif // V8_AST_SCOPES_H_ | 907 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |