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

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

Issue 186853003: Fix error message when assigning to a local const variable (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | 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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 kEmitStoreBarrier); 725 kEmitStoreBarrier);
726 Do(store); 726 Do(store);
727 return ExitTempLocalScope(tmp_var); 727 return ExitTempLocalScope(tmp_var);
728 } else { 728 } else {
729 return new StoreLocalInstr(local, value); 729 return new StoreLocalInstr(local, value);
730 } 730 }
731 } 731 }
732 732
733 733
734 Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) { 734 Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) {
735 if (local.is_captured()) { 735 if (local.IsConst()) {
736 return new ConstantInstr(*local.ConstValue());
737 } else if (local.is_captured()) {
736 intptr_t delta = 738 intptr_t delta =
737 owner()->context_level() - local.owner()->context_level(); 739 owner()->context_level() - local.owner()->context_level();
738 ASSERT(delta >= 0); 740 ASSERT(delta >= 0);
739 Value* context = Bind(new CurrentContextInstr()); 741 Value* context = Bind(new CurrentContextInstr());
740 while (delta-- > 0) { 742 while (delta-- > 0) {
741 context = Bind(new LoadFieldInstr( 743 context = Bind(new LoadFieldInstr(
742 context, Context::parent_offset(), Type::ZoneHandle())); 744 context, Context::parent_offset(), Type::ZoneHandle()));
743 } 745 }
744 return new LoadFieldInstr(context, 746 return new LoadFieldInstr(context,
745 Context::variable_offset(local.index()), 747 Context::variable_offset(local.index()),
(...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3919 LanguageError::kError, 3921 LanguageError::kError,
3920 Heap::kNew, 3922 Heap::kNew,
3921 "FlowGraphBuilder Bailout: %s %s", 3923 "FlowGraphBuilder Bailout: %s %s",
3922 String::Handle(function.name()).ToCString(), 3924 String::Handle(function.name()).ToCString(),
3923 reason)); 3925 reason));
3924 Isolate::Current()->long_jump_base()->Jump(1, error); 3926 Isolate::Current()->long_jump_base()->Jump(1, error);
3925 } 3927 }
3926 3928
3927 3929
3928 } // namespace dart 3930 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698