diff --git a/src/apps/debugger/model/ExpressionInfo.cpp b/src/apps/debugger/model/ExpressionInfo.cpp index 9aaf0d61e5..74c7083367 100644 --- a/src/apps/debugger/model/ExpressionInfo.cpp +++ b/src/apps/debugger/model/ExpressionInfo.cpp @@ -6,6 +6,7 @@ #include "ExpressionInfo.h" +#include "Type.h" #include "Value.h" #include "ValueNode.h" @@ -17,7 +18,8 @@ ExpressionResult::ExpressionResult() : fResultKind(EXPRESSION_RESULT_KIND_UNKNOWN), fPrimitiveValue(NULL), - fValueNodeValue(NULL) + fValueNodeValue(NULL), + fTypeResult(NULL) { } @@ -29,6 +31,9 @@ ExpressionResult::~ExpressionResult() if (fValueNodeValue != NULL) fValueNodeValue->ReleaseReference(); + + if (fTypeResult != NULL) + fTypeResult->ReleaseReference(); } @@ -70,6 +75,19 @@ ExpressionResult::SetToValueNode(ValueNodeChild* child) } +void +ExpressionResult::SetToType(Type* type) +{ + _Unset(); + + fTypeResult = type; + if (fTypeResult != NULL) { + fTypeResult->AcquireReference(); + fResultKind = EXPRESSION_RESULT_KIND_TYPE; + } +} + + void ExpressionResult::_Unset() { @@ -83,6 +101,11 @@ ExpressionResult::_Unset() fValueNodeValue = NULL; } + if (fTypeResult != NULL) { + fTypeResult->ReleaseReference(); + fTypeResult = NULL; + } + fResultKind = EXPRESSION_RESULT_KIND_UNKNOWN; } diff --git a/src/apps/debugger/model/ExpressionInfo.h b/src/apps/debugger/model/ExpressionInfo.h index feab5c40f2..eb468f705b 100644 --- a/src/apps/debugger/model/ExpressionInfo.h +++ b/src/apps/debugger/model/ExpressionInfo.h @@ -13,6 +13,7 @@ #include +class Type; class Value; class ValueNodeChild; @@ -20,7 +21,8 @@ class ValueNodeChild; enum expression_result_kind { EXPRESSION_RESULT_KIND_UNKNOWN = 0, EXPRESSION_RESULT_KIND_PRIMITIVE, - EXPRESSION_RESULT_KIND_VALUE_NODE + EXPRESSION_RESULT_KIND_VALUE_NODE, + EXPRESSION_RESULT_KIND_TYPE }; @@ -30,23 +32,26 @@ public: virtual ~ExpressionResult(); - expression_result_kind Kind() const { return fResultKind; } + expression_result_kind Kind() const { return fResultKind; } Value* PrimitiveValue() const { return fPrimitiveValue; } ValueNodeChild* ValueNodeValue() const { return fValueNodeValue; } + Type* GetType() const + { return fTypeResult; } - void SetToPrimitive(Value* value); - void SetToValueNode(ValueNodeChild* child); + void SetToPrimitive(Value* value); + void SetToValueNode(ValueNodeChild* child); + void SetToType(Type* type); +private: + void _Unset(); private: - void _Unset(); - -private: - expression_result_kind fResultKind; - Value* fPrimitiveValue; - ValueNodeChild* fValueNodeValue; + expression_result_kind fResultKind; + Value* fPrimitiveValue; + ValueNodeChild* fValueNodeValue; + Type* fTypeResult; };