Debugger: Add value node subclasses for expressions.

- Since expression value nodes need to be handled quite differently from
  other value nodes, and aren't specifically tied to variable object
  instances, create distinct implementing subclasses ExpressionValueNode{Child}
  to represent them.
This commit is contained in:
Rene Gollent
2014-11-08 10:48:57 -05:00
parent ba4cfb2439
commit 8a038c4440
2 changed files with 150 additions and 0 deletions
@@ -0,0 +1,94 @@
/*
* Copyright 2014, Rene Gollent, [email protected]
* Distributed under the terms of the MIT License.
*/
#include "ExpressionValueNode.h"
#include <new>
#include "Type.h"
// #pragma mark - ExpressionValueNode
ExpressionValueNode::ExpressionValueNode(ExpressionValueNodeChild* nodeChild,
Type* type)
:
ChildlessValueNode(nodeChild),
fType(type)
{
fType->AcquireReference();
}
ExpressionValueNode::~ExpressionValueNode()
{
fType->ReleaseReference();
}
Type*
ExpressionValueNode::GetType() const
{
return fType;
}
status_t
ExpressionValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
ValueLocation*& _location, Value*& _value)
{
return B_NOT_SUPPORTED;
}
// #pragma mark - ExpressionValueNodeChild
ExpressionValueNodeChild::ExpressionValueNodeChild(const BString& expression,
Type* resultType)
:
fExpression(expression),
fResultType(resultType)
{
fResultType->AcquireReference();
}
ExpressionValueNodeChild::~ExpressionValueNodeChild()
{
fResultType->ReleaseReference();
}
const BString&
ExpressionValueNodeChild::Name() const
{
return fExpression;
}
Type*
ExpressionValueNodeChild::GetType() const
{
return fResultType;
}
ValueNode*
ExpressionValueNodeChild::Parent() const
{
return NULL;
}
status_t
ExpressionValueNodeChild::ResolveLocation(ValueLoader* valueLoader,
ValueLocation*& _location)
{
_location = NULL;
return B_OK;
}
@@ -0,0 +1,56 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef EXPRESSION_VALUE_NODE_H
#define EXPRESSION_VALUE_NODE_H
#include "ValueNode.h"
class ExpressionValueNodeChild;
class ExpressionValueNode : public ChildlessValueNode {
public:
ExpressionValueNode(
ExpressionValueNodeChild* nodeChild,
Type* type);
virtual ~ExpressionValueNode();
virtual Type* GetType() const;
virtual status_t ResolvedLocationAndValue(
ValueLoader* valueLoader,
ValueLocation*& _location,
Value*& _value);
private:
Type* fType;
};
class ExpressionValueNodeChild : public ValueNodeChild {
public:
ExpressionValueNodeChild(
const BString& expression,
Type* type);
virtual ~ExpressionValueNodeChild();
virtual const BString& Name() const;
virtual Type* GetType() const;
virtual ValueNode* Parent() const;
const BString& GetExpression() const { return fExpression; };
virtual status_t ResolveLocation(ValueLoader* valueLoader,
ValueLocation*& _location);
private:
BString fExpression;
Type* fResultType;
};
#endif // EXPRESSION_VALUE_NODE_H