OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_VARIABLES_H_ | 5 #ifndef V8_VARIABLES_H_ |
6 #define V8_VARIABLES_H_ | 6 #define V8_VARIABLES_H_ |
7 | 7 |
8 #include "src/ast-value-factory.h" | 8 #include "src/ast-value-factory.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Usage info. | 180 // Usage info. |
181 bool force_context_allocation_; // set by variable resolver | 181 bool force_context_allocation_; // set by variable resolver |
182 bool is_used_; | 182 bool is_used_; |
183 InitializationFlag initialization_flag_; | 183 InitializationFlag initialization_flag_; |
184 MaybeAssignedFlag maybe_assigned_; | 184 MaybeAssignedFlag maybe_assigned_; |
185 }; | 185 }; |
186 | 186 |
187 class ClassVariable : public Variable { | 187 class ClassVariable : public Variable { |
188 public: | 188 public: |
189 ClassVariable(Scope* scope, const AstRawString* name, VariableMode mode, | 189 ClassVariable(Scope* scope, const AstRawString* name, VariableMode mode, |
190 Kind kind, InitializationFlag initialization_flag, | 190 InitializationFlag initialization_flag, |
191 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, | 191 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, |
192 int declaration_group_start = -1) | 192 int declaration_group_start = -1) |
193 : Variable(scope, name, mode, kind, initialization_flag, | 193 : Variable(scope, name, mode, Variable::CLASS, initialization_flag, |
194 maybe_assigned_flag), | 194 maybe_assigned_flag), |
195 declaration_group_start_(declaration_group_start), | 195 declaration_group_start_(declaration_group_start), |
196 corresponding_outer_class_variable_(nullptr) {} | 196 corresponding_outer_class_variable_(nullptr) {} |
197 | 197 |
198 int declaration_group_start() const { return declaration_group_start_; } | 198 int declaration_group_start() const { return declaration_group_start_; } |
199 | 199 |
200 ClassVariable* corresponding_outer_class_variable() const { | 200 ClassVariable* corresponding_outer_class_variable() const { |
201 return corresponding_outer_class_variable_; | 201 return corresponding_outer_class_variable_; |
202 } | 202 } |
203 void set_corresponding_outer_class_variable(ClassVariable* var) { | 203 void set_corresponding_outer_class_variable(ClassVariable* var) { |
204 corresponding_outer_class_variable_ = var; | 204 corresponding_outer_class_variable_ = var; |
205 } | 205 } |
206 | 206 |
207 private: | 207 private: |
208 // For classes we keep track of consecutive groups of delcarations. They are | 208 // For classes we keep track of consecutive groups of delcarations. They are |
209 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement | 209 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement |
210 // checks for functions too. | 210 // checks for functions too. |
211 int declaration_group_start_; | 211 int declaration_group_start_; |
212 ClassVariable* corresponding_outer_class_variable_; | 212 ClassVariable* corresponding_outer_class_variable_; |
213 }; | 213 }; |
214 } } // namespace v8::internal | 214 } } // namespace v8::internal |
215 | 215 |
216 #endif // V8_VARIABLES_H_ | 216 #endif // V8_VARIABLES_H_ |
OLD | NEW |