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 |
233 // Add a variable to the scope. Returns false if a variable with the | 236 // Add a variable to the scope. Returns false if a variable with the |
234 // same name is already present. | 237 // same name is already present. |
235 bool AddVariable(LocalVariable* variable); | 238 bool AddVariable(LocalVariable* variable); |
236 | 239 |
237 // Add a label to the scope. Returns false if a label with the same name | 240 // Add a label to the scope. Returns false if a label with the same name |
238 // is already present. | 241 // is already present. |
239 bool AddLabel(SourceLabel* label); | 242 bool AddLabel(SourceLabel* label); |
240 | 243 |
241 // Lookup a variable in this scope only. | 244 // Lookup a variable in this scope only. |
242 LocalVariable* LocalLookupVariable(const String& name) const; | 245 LocalVariable* LocalLookupVariable(const String& name) const; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // List of names referenced in this scope and its children that | 360 // List of names referenced in this scope and its children that |
358 // are not resolved to local variables. | 361 // are not resolved to local variables. |
359 GrowableArray<NameReference*> referenced_; | 362 GrowableArray<NameReference*> referenced_; |
360 | 363 |
361 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 364 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
362 }; | 365 }; |
363 | 366 |
364 } // namespace dart | 367 } // namespace dart |
365 | 368 |
366 #endif // VM_SCOPES_H_ | 369 #endif // VM_SCOPES_H_ |
OLD | NEW |