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

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
Index: runtime/vm/scopes.h
===================================================================
--- runtime/vm/scopes.h (revision 14690)
+++ 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;
siva 2012/11/08 20:30:01 'value' is zone allocated and stored here. Will th
hausner 2012/11/09 00:10:21 Local variable objects and scopes are only alive d
+ }
+
+ 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.

Powered by Google App Engine
This is Rietveld 408576698