| 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 #include "vm/scopes.h" | 5 #include "vm/scopes.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/stack_frame.h" | 8 #include "vm/stack_frame.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 | 10 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, | 290 void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars, |
| 291 int16_t* scope_id) { | 291 int16_t* scope_id) { |
| 292 (*scope_id)++; | 292 (*scope_id)++; |
| 293 if (HasContextLevel() && | 293 if (HasContextLevel() && |
| 294 ((parent() == NULL) || | 294 ((parent() == NULL) || |
| 295 (!parent()->HasContextLevel()) || | 295 (!parent()->HasContextLevel()) || |
| 296 (parent()->context_level() != context_level()))) { | 296 (parent()->context_level() != context_level()))) { |
| 297 // This is the outermost scope with a context level or this scope's | 297 // This is the outermost scope with a context level or this scope's |
| 298 // context level differs from its parent's level. | 298 // context level differs from its parent's level. |
| 299 VarDesc desc; | 299 VarDesc desc; |
| 300 desc.name = &Object::null_string(); // No name. | 300 desc.name = &Symbols::Empty(); // No name. |
| 301 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel); | 301 desc.info.set_kind(RawLocalVarDescriptors::kContextLevel); |
| 302 desc.info.scope_id = *scope_id; | 302 desc.info.scope_id = *scope_id; |
| 303 desc.info.begin_pos = begin_token_pos(); | 303 desc.info.begin_pos = begin_token_pos(); |
| 304 desc.info.end_pos = end_token_pos(); | 304 desc.info.end_pos = end_token_pos(); |
| 305 desc.info.set_index(context_level()); | 305 desc.info.set_index(context_level()); |
| 306 vars->Add(desc); | 306 vars->Add(desc); |
| 307 } | 307 } |
| 308 for (int i = 0; i < this->variables_.length(); i++) { | 308 for (int i = 0; i < this->variables_.length(); i++) { |
| 309 LocalVariable* var = variables_[i]; | 309 LocalVariable* var = variables_[i]; |
| 310 if ((var->owner() == this) && !var->is_invisible()) { | 310 if ((var->owner() == this) && !var->is_invisible()) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 return fixed_parameter_count - (index() - kParamEndSlotFromFp); | 672 return fixed_parameter_count - (index() - kParamEndSlotFromFp); |
| 673 } else { | 673 } else { |
| 674 // Shift negative indexes so that the lowest one is 0 (they are still | 674 // Shift negative indexes so that the lowest one is 0 (they are still |
| 675 // non-positive). | 675 // non-positive). |
| 676 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); | 676 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 | 680 |
| 681 } // namespace dart | 681 } // namespace dart |
| OLD | NEW |