Debugger: Add type results to ExpressionInfo.
- In addition to a primitive or value node, expressions can potentially result in types as well. As such, extend ExpressionInfo to be able to return one, and indicate such a result kind appropriately.
This commit is contained in:
parent
042bb68ed6
commit
5a4887a0db
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <Variant.h>
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue