| 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/ast.h" | 7 #include "vm/ast.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 SourceLabel* label = labels_[i]; | 287 SourceLabel* label = labels_[i]; |
| 288 if (label->name().Equals(name)) { | 288 if (label->name().Equals(name)) { |
| 289 return label; | 289 return label; |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 return NULL; | 292 return NULL; |
| 293 } | 293 } |
| 294 | 294 |
| 295 | 295 |
| 296 LocalVariable* LocalScope::LocalLookupVariable(const String& name) const { | 296 LocalVariable* LocalScope::LocalLookupVariable(const String& name) const { |
| 297 ASSERT(name.IsSymbol()); |
| 297 for (intptr_t i = 0; i < variables_.length(); i++) { | 298 for (intptr_t i = 0; i < variables_.length(); i++) { |
| 298 LocalVariable* var = variables_[i]; | 299 LocalVariable* var = variables_[i]; |
| 299 if (var->name().Equals(name) && !var->is_invisible_) { | 300 ASSERT(var->name().IsSymbol()); |
| 301 if ((var->name().raw() == name.raw()) && !var->is_invisible_) { |
| 300 return var; | 302 return var; |
| 301 } | 303 } |
| 302 } | 304 } |
| 303 return NULL; | 305 return NULL; |
| 304 } | 306 } |
| 305 | 307 |
| 306 | 308 |
| 307 LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) { | 309 LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) { |
| 308 LocalScope* current_scope = this; | 310 LocalScope* current_scope = this; |
| 309 while (current_scope != NULL) { | 311 while (current_scope != NULL) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } else { | 566 } else { |
| 565 // Shift negative indexes so that the lowest one is 0 (they are still | 567 // Shift negative indexes so that the lowest one is 0 (they are still |
| 566 // non-positive). | 568 // non-positive). |
| 567 return fixed_parameter_count - | 569 return fixed_parameter_count - |
| 568 (index() - ParsedFunction::kFirstLocalSlotIndex); | 570 (index() - ParsedFunction::kFirstLocalSlotIndex); |
| 569 } | 571 } |
| 570 } | 572 } |
| 571 | 573 |
| 572 | 574 |
| 573 } // namespace dart | 575 } // namespace dart |
| OLD | NEW |