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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 14713)
+++ runtime/vm/object.cc (working copy)
@@ -7353,7 +7353,18 @@
}
+bool ContextScope::IsConstAt(intptr_t scope_index) const {
+ return Bool::Handle(VariableDescAddr(scope_index)->is_const).value();
+}
+
+
+void ContextScope::SetIsConstAt(intptr_t scope_index, bool is_const) const {
+ VariableDescAddr(scope_index)->is_const = Bool::Get(is_const);
+}
+
+
RawAbstractType* ContextScope::TypeAt(intptr_t scope_index) const {
+ ASSERT(!IsConstAt(scope_index));
return VariableDescAddr(scope_index)->type;
}
@@ -7364,6 +7375,19 @@
}
+RawInstance* ContextScope::ConstValueAt(intptr_t scope_index) const {
+ ASSERT(IsConstAt(scope_index));
+ return VariableDescAddr(scope_index)->value;
+}
+
+
+void ContextScope::SetConstValueAt(
+ intptr_t scope_index, const Instance& value) const {
+ ASSERT(IsConstAt(scope_index));
+ StorePointer(&(VariableDescAddr(scope_index)->value), value.raw());
+}
+
+
intptr_t ContextScope::ContextIndexAt(intptr_t scope_index) const {
return Smi::Value(VariableDescAddr(scope_index)->context_index);
}
« 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