Chromium Code Reviews| 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. |