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/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 Variable* Declare( | 33 Variable* Declare( |
34 Zone* zone, Scope* scope, const AstRawString* name, VariableMode mode, | 34 Zone* zone, Scope* scope, const AstRawString* name, VariableMode mode, |
35 VariableKind kind = NORMAL_VARIABLE, | 35 VariableKind kind = NORMAL_VARIABLE, |
36 InitializationFlag initialization_flag = kCreatedInitialized, | 36 InitializationFlag initialization_flag = kCreatedInitialized, |
37 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, | 37 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, |
38 bool* added = nullptr); | 38 bool* added = nullptr); |
39 | 39 |
40 // Records that "name" exists (if not recorded yet) but doesn't create a | 40 // Records that "name" exists (if not recorded yet) but doesn't create a |
41 // Variable. Useful for preparsing. | 41 // Variable. Useful for preparsing. |
42 void DeclareName(Zone* zone, const AstRawString* name, VariableMode mode); | 42 Variable* DeclareName(Zone* zone, const AstRawString* name, |
| 43 VariableMode mode); |
43 | 44 |
44 Variable* Lookup(const AstRawString* name); | 45 Variable* Lookup(const AstRawString* name); |
45 void Remove(Variable* var); | 46 void Remove(Variable* var); |
46 void Add(Zone* zone, Variable* var); | 47 void Add(Zone* zone, Variable* var); |
47 }; | 48 }; |
48 | 49 |
49 | 50 |
50 // Sloppy block-scoped function declarations to var-bind | 51 // Sloppy block-scoped function declarations to var-bind |
51 class SloppyBlockFunctionMap : public ZoneHashMap { | 52 class SloppyBlockFunctionMap : public ZoneHashMap { |
52 public: | 53 public: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 InitializationFlag init_flag = kCreatedInitialized, | 174 InitializationFlag init_flag = kCreatedInitialized, |
174 VariableKind kind = NORMAL_VARIABLE, | 175 VariableKind kind = NORMAL_VARIABLE, |
175 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); | 176 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); |
176 | 177 |
177 Variable* DeclareVariable(Declaration* declaration, VariableMode mode, | 178 Variable* DeclareVariable(Declaration* declaration, VariableMode mode, |
178 InitializationFlag init, | 179 InitializationFlag init, |
179 bool allow_harmony_restrictive_generators, | 180 bool allow_harmony_restrictive_generators, |
180 bool* sloppy_mode_block_scope_function_redefinition, | 181 bool* sloppy_mode_block_scope_function_redefinition, |
181 bool* ok); | 182 bool* ok); |
182 | 183 |
183 void DeclareVariableName(const AstRawString* name, VariableMode mode); | 184 Variable* DeclareVariableName(const AstRawString* name, VariableMode mode); |
184 | 185 |
185 // Declarations list. | 186 // Declarations list. |
186 ThreadedList<Declaration>* declarations() { return &decls_; } | 187 ThreadedList<Declaration>* declarations() { return &decls_; } |
187 | 188 |
188 ThreadedList<Variable>* locals() { return &locals_; } | 189 ThreadedList<Variable>* locals() { return &locals_; } |
189 | 190 |
190 // Create a new unresolved variable. | 191 // Create a new unresolved variable. |
191 VariableProxy* NewUnresolved(AstNodeFactory* factory, | 192 VariableProxy* NewUnresolved(AstNodeFactory* factory, |
192 const AstRawString* name, | 193 const AstRawString* name, |
193 int start_position = kNoSourcePosition, | 194 int start_position = kNoSourcePosition, |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 void AllocateModuleVariables(); | 897 void AllocateModuleVariables(); |
897 | 898 |
898 private: | 899 private: |
899 ModuleDescriptor* module_descriptor_; | 900 ModuleDescriptor* module_descriptor_; |
900 }; | 901 }; |
901 | 902 |
902 } // namespace internal | 903 } // namespace internal |
903 } // namespace v8 | 904 } // namespace v8 |
904 | 905 |
905 #endif // V8_AST_SCOPES_H_ | 906 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |