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

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

Issue 11265047: Implement const expressions for local variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « runtime/vm/object.h ('k') | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 7335 matching lines...) Expand 10 before | Expand all | Expand 10 after
7346 bool ContextScope::IsFinalAt(intptr_t scope_index) const { 7346 bool ContextScope::IsFinalAt(intptr_t scope_index) const {
7347 return Bool::Handle(VariableDescAddr(scope_index)->is_final).value(); 7347 return Bool::Handle(VariableDescAddr(scope_index)->is_final).value();
7348 } 7348 }
7349 7349
7350 7350
7351 void ContextScope::SetIsFinalAt(intptr_t scope_index, bool is_final) const { 7351 void ContextScope::SetIsFinalAt(intptr_t scope_index, bool is_final) const {
7352 VariableDescAddr(scope_index)->is_final = Bool::Get(is_final); 7352 VariableDescAddr(scope_index)->is_final = Bool::Get(is_final);
7353 } 7353 }
7354 7354
7355 7355
7356 bool ContextScope::IsConstAt(intptr_t scope_index) const {
7357 return Bool::Handle(VariableDescAddr(scope_index)->is_const).value();
7358 }
7359
7360
7361 void ContextScope::SetIsConstAt(intptr_t scope_index, bool is_const) const {
7362 VariableDescAddr(scope_index)->is_const = Bool::Get(is_const);
7363 }
7364
7365
7356 RawAbstractType* ContextScope::TypeAt(intptr_t scope_index) const { 7366 RawAbstractType* ContextScope::TypeAt(intptr_t scope_index) const {
7367 ASSERT(!IsConstAt(scope_index));
7357 return VariableDescAddr(scope_index)->type; 7368 return VariableDescAddr(scope_index)->type;
7358 } 7369 }
7359 7370
7360 7371
7361 void ContextScope::SetTypeAt( 7372 void ContextScope::SetTypeAt(
7362 intptr_t scope_index, const AbstractType& type) const { 7373 intptr_t scope_index, const AbstractType& type) const {
7363 StorePointer(&(VariableDescAddr(scope_index)->type), type.raw()); 7374 StorePointer(&(VariableDescAddr(scope_index)->type), type.raw());
7364 } 7375 }
7365 7376
7366 7377
7378 RawInstance* ContextScope::ConstValueAt(intptr_t scope_index) const {
7379 ASSERT(IsConstAt(scope_index));
7380 return VariableDescAddr(scope_index)->value;
7381 }
7382
7383
7384 void ContextScope::SetConstValueAt(
7385 intptr_t scope_index, const Instance& value) const {
7386 ASSERT(IsConstAt(scope_index));
7387 StorePointer(&(VariableDescAddr(scope_index)->value), value.raw());
7388 }
7389
7390
7367 intptr_t ContextScope::ContextIndexAt(intptr_t scope_index) const { 7391 intptr_t ContextScope::ContextIndexAt(intptr_t scope_index) const {
7368 return Smi::Value(VariableDescAddr(scope_index)->context_index); 7392 return Smi::Value(VariableDescAddr(scope_index)->context_index);
7369 } 7393 }
7370 7394
7371 7395
7372 void ContextScope::SetContextIndexAt(intptr_t scope_index, 7396 void ContextScope::SetContextIndexAt(intptr_t scope_index,
7373 intptr_t context_index) const { 7397 intptr_t context_index) const {
7374 VariableDescAddr(scope_index)->context_index = Smi::New(context_index); 7398 VariableDescAddr(scope_index)->context_index = Smi::New(context_index);
7375 } 7399 }
7376 7400
(...skipping 4574 matching lines...) Expand 10 before | Expand all | Expand 10 after
11951 } 11975 }
11952 return result.raw(); 11976 return result.raw();
11953 } 11977 }
11954 11978
11955 11979
11956 const char* WeakProperty::ToCString() const { 11980 const char* WeakProperty::ToCString() const {
11957 return "_WeakProperty"; 11981 return "_WeakProperty";
11958 } 11982 }
11959 11983
11960 } // namespace dart 11984 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698