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 #include "vm/scopes.h" | 5 #include "vm/scopes.h" |
6 | 6 |
7 #include "vm/ast.h" | 7 #include "vm/ast.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 context_scope.SetNameAt(0, name); | 403 context_scope.SetNameAt(0, name); |
404 context_scope.SetIsFinalAt(0, true); | 404 context_scope.SetIsFinalAt(0, true); |
405 const AbstractType& type = AbstractType::Handle(func.ParameterTypeAt(0)); | 405 const AbstractType& type = AbstractType::Handle(func.ParameterTypeAt(0)); |
406 context_scope.SetTypeAt(0, type); | 406 context_scope.SetTypeAt(0, type); |
407 context_scope.SetContextIndexAt(0, 0); | 407 context_scope.SetContextIndexAt(0, 0); |
408 context_scope.SetContextLevelAt(0, 0); | 408 context_scope.SetContextLevelAt(0, 0); |
409 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count. | 409 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count. |
410 return context_scope.raw(); | 410 return context_scope.raw(); |
411 } | 411 } |
412 | 412 |
| 413 |
| 414 bool LocalVariable::Equals(const LocalVariable& other) const { |
| 415 if (HasIndex() && other.HasIndex() && (index() == other.index())) { |
| 416 if (is_captured() == other.is_captured()) { |
| 417 if (!is_captured()) { |
| 418 return true; |
| 419 } |
| 420 if (owner()->context_level() == other.owner()->context_level()) { |
| 421 return true; |
| 422 } |
| 423 } |
| 424 } |
| 425 return false; |
| 426 } |
| 427 |
413 } // namespace dart | 428 } // namespace dart |
OLD | NEW |