OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_SCOPES_H_ | 5 #ifndef VM_SCOPES_H_ |
6 #define VM_SCOPES_H_ | 6 #define VM_SCOPES_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 intptr_t begin_token_pos() const { return begin_token_pos_; } | 223 intptr_t begin_token_pos() const { return begin_token_pos_; } |
224 void set_begin_token_pos(intptr_t value) { begin_token_pos_ = value; } | 224 void set_begin_token_pos(intptr_t value) { begin_token_pos_ = value; } |
225 | 225 |
226 intptr_t end_token_pos() const { return end_token_pos_; } | 226 intptr_t end_token_pos() const { return end_token_pos_; } |
227 void set_end_token_pos(intptr_t value) { end_token_pos_ = value; } | 227 void set_end_token_pos(intptr_t value) { end_token_pos_ = value; } |
228 | 228 |
229 // The number of variables allocated in the context and belonging to this | 229 // The number of variables allocated in the context and belonging to this |
230 // scope and to its children at the same loop level. | 230 // scope and to its children at the same loop level. |
231 int num_context_variables() const { return num_context_variables_; } | 231 int num_context_variables() const { return num_context_variables_; } |
232 | 232 |
233 // Forget all the variables in the scope. | |
234 void Clear(); | |
235 | |
236 // Add a variable to the scope. Returns false if a variable with the | 233 // Add a variable to the scope. Returns false if a variable with the |
237 // same name is already present. | 234 // same name is already present. |
238 bool AddVariable(LocalVariable* variable); | 235 bool AddVariable(LocalVariable* variable); |
239 | 236 |
240 // Add a label to the scope. Returns false if a label with the same name | 237 // Add a label to the scope. Returns false if a label with the same name |
241 // is already present. | 238 // is already present. |
242 bool AddLabel(SourceLabel* label); | 239 bool AddLabel(SourceLabel* label); |
243 | 240 |
244 // Lookup a variable in this scope only. | 241 // Lookup a variable in this scope only. |
245 LocalVariable* LocalLookupVariable(const String& name) const; | 242 LocalVariable* LocalLookupVariable(const String& name) const; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // List of names referenced in this scope and its children that | 357 // List of names referenced in this scope and its children that |
361 // are not resolved to local variables. | 358 // are not resolved to local variables. |
362 GrowableArray<NameReference*> referenced_; | 359 GrowableArray<NameReference*> referenced_; |
363 | 360 |
364 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 361 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
365 }; | 362 }; |
366 | 363 |
367 } // namespace dart | 364 } // namespace dart |
368 | 365 |
369 #endif // VM_SCOPES_H_ | 366 #endif // VM_SCOPES_H_ |
OLD | NEW |