Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: runtime/vm/scopes.cc

Issue 1528873002: VM: Use read-only handle Object::dynamic_type() where possible. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/regexp_assembler_ir.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/regexp_assembler_ir.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698