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

Unified Diff: runtime/vm/scopes.h

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/raw_object.h ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.h
===================================================================
--- runtime/vm/scopes.h (revision 14713)
+++ runtime/vm/scopes.h (working copy)
@@ -28,6 +28,7 @@
name_(name),
owner_(NULL),
type_(type),
+ const_value_(NULL),
is_final_(false),
is_captured_(false),
is_invisible_(false),
@@ -71,6 +72,20 @@
is_invisible_ = value;
}
+ bool IsConst() const {
+ return const_value_ != NULL;
+ }
+
+ void SetConstValue(const Instance& value) {
+ ASSERT(value.IsZoneHandle());
+ const_value_ = &value;
+ }
+
+ const Instance* ConstValue() const {
+ ASSERT(IsConst());
+ return const_value_;
+ }
+
bool Equals(const LocalVariable& other) const;
// Map the frame index to a bit-vector index. Assumes the variable is
@@ -88,6 +103,8 @@
const AbstractType& type_; // Declaration type of local variable.
+ const Instance* const_value_; // NULL or compile-time const value.
+
bool is_final_; // If true, this variable is readonly.
bool is_captured_; // If true, this variable lives in the context, otherwise
// in the stack frame.
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698