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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) { | 569 LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) { |
570 // The function level of the outer scope is one less than the function level | 570 // The function level of the outer scope is one less than the function level |
571 // of the current function, which is 0. | 571 // of the current function, which is 0. |
572 LocalScope* outer_scope = new LocalScope(NULL, -1, 0); | 572 LocalScope* outer_scope = new LocalScope(NULL, -1, 0); |
573 // Add all variables as aliases to the outer scope. | 573 // Add all variables as aliases to the outer scope. |
574 for (int i = 0; i < context_scope.num_variables(); i++) { | 574 for (int i = 0; i < context_scope.num_variables(); i++) { |
575 LocalVariable* variable; | 575 LocalVariable* variable; |
576 if (context_scope.IsConstAt(i)) { | 576 if (context_scope.IsConstAt(i)) { |
577 variable = new LocalVariable(context_scope.TokenIndexAt(i), | 577 variable = new LocalVariable(context_scope.TokenIndexAt(i), |
578 String::ZoneHandle(context_scope.NameAt(i)), | 578 String::ZoneHandle(context_scope.NameAt(i)), |
579 AbstractType::ZoneHandle(Type::DynamicType())); | 579 Object::dynamic_type()); |
580 variable->SetConstValue( | 580 variable->SetConstValue( |
581 Instance::ZoneHandle(context_scope.ConstValueAt(i))); | 581 Instance::ZoneHandle(context_scope.ConstValueAt(i))); |
582 } else { | 582 } else { |
583 variable = new LocalVariable(context_scope.TokenIndexAt(i), | 583 variable = new LocalVariable(context_scope.TokenIndexAt(i), |
584 String::ZoneHandle(context_scope.NameAt(i)), | 584 String::ZoneHandle(context_scope.NameAt(i)), |
585 AbstractType::ZoneHandle(context_scope.TypeAt(i))); | 585 AbstractType::ZoneHandle(context_scope.TypeAt(i))); |
586 } | 586 } |
587 variable->set_is_captured(); | 587 variable->set_is_captured(); |
588 variable->set_index(context_scope.ContextIndexAt(i)); | 588 variable->set_index(context_scope.ContextIndexAt(i)); |
589 if (context_scope.IsFinalAt(i)) { | 589 if (context_scope.IsFinalAt(i)) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return fixed_parameter_count - (index() - kParamEndSlotFromFp); | 668 return fixed_parameter_count - (index() - kParamEndSlotFromFp); |
669 } else { | 669 } else { |
670 // Shift negative indexes so that the lowest one is 0 (they are still | 670 // Shift negative indexes so that the lowest one is 0 (they are still |
671 // non-positive). | 671 // non-positive). |
672 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); | 672 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 | 676 |
677 } // namespace dart | 677 } // namespace dart |
OLD | NEW |