| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 LocalScope* parent() const { return parent_; } | 160 LocalScope* parent() const { return parent_; } |
| 161 LocalScope* child() const { return child_; } | 161 LocalScope* child() const { return child_; } |
| 162 LocalScope* sibling() const { return sibling_; } | 162 LocalScope* sibling() const { return sibling_; } |
| 163 int function_level() const { return function_level_; } | 163 int function_level() const { return function_level_; } |
| 164 int loop_level() const { return loop_level_; } | 164 int loop_level() const { return loop_level_; } |
| 165 | 165 |
| 166 // Check if this scope is nested within the passed in scope. | 166 // Check if this scope is nested within the passed in scope. |
| 167 bool IsNestedWithin(LocalScope* scope) const; | 167 bool IsNestedWithin(LocalScope* scope) const; |
| 168 | 168 |
| 169 // The context level is only set in a scope that is either the owner scope of |
| 170 // a captured variable or that is the owner scope of a context. |
| 169 bool HasContextLevel() const { | 171 bool HasContextLevel() const { |
| 170 return context_level_ != kUnitializedContextLevel_; | 172 return context_level_ != kUnitializedContextLevel_; |
| 171 } | 173 } |
| 172 int context_level() const { | 174 int context_level() const { |
| 173 ASSERT(HasContextLevel()); | 175 ASSERT(HasContextLevel()); |
| 174 return context_level_; | 176 return context_level_; |
| 175 } | 177 } |
| 176 void set_context_level(int context_level) { | 178 void set_context_level(int context_level) { |
| 177 ASSERT(!HasContextLevel()); | 179 ASSERT(!HasContextLevel()); |
| 178 ASSERT(context_level != kUnitializedContextLevel_); | 180 ASSERT(context_level != kUnitializedContextLevel_); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 intptr_t end_token_index_; // Token index of end of scope. | 294 intptr_t end_token_index_; // Token index of end of scope. |
| 293 GrowableArray<LocalVariable*> variables_; | 295 GrowableArray<LocalVariable*> variables_; |
| 294 GrowableArray<SourceLabel*> labels_; | 296 GrowableArray<SourceLabel*> labels_; |
| 295 | 297 |
| 296 DISALLOW_COPY_AND_ASSIGN(LocalScope); | 298 DISALLOW_COPY_AND_ASSIGN(LocalScope); |
| 297 }; | 299 }; |
| 298 | 300 |
| 299 } // namespace dart | 301 } // namespace dart |
| 300 | 302 |
| 301 #endif // VM_SCOPES_H_ | 303 #endif // VM_SCOPES_H_ |
| OLD | NEW |