Cleanups to simplify handling of pointer vs value types.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42353 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-07-01 01:54:58 +00:00
parent f74d4e95d9
commit 8a7985745c
2 changed files with 15 additions and 10 deletions
@@ -64,9 +64,7 @@ public:
{ {
ValueLocation* parentLocation = fParent->Location(); ValueLocation* parentLocation = fParent->Location();
ValueLocation* location; ValueLocation* location;
CompoundType* type = dynamic_cast<CompoundType*>(fParent->GetType()); CompoundType* type = fParent->GetMessageType();
if (type == NULL)
return B_BAD_VALUE;
status_t error = type->ResolveDataMemberLocation(fMember, status_t error = type->ResolveDataMemberLocation(fMember,
*parentLocation, location); *parentLocation, location);
@@ -93,6 +91,7 @@ BMessageValueNode::BMessageValueNode(ValueNodeChild* nodeChild,
: :
ValueNode(nodeChild), ValueNode(nodeChild),
fType(type), fType(type),
fMessageType(NULL),
fMessage() fMessage()
{ {
fType->AcquireReference(); fType->AcquireReference();
@@ -154,6 +153,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
pieceLocation.SetToMemory(address.ToUInt64()); pieceLocation.SetToMemory(address.ToUInt64());
location->SetPieceAt(0, pieceLocation); location->SetPieceAt(0, pieceLocation);
} }
fMessageType = baseType;
_location = location; _location = location;
_value = NULL; _value = NULL;
@@ -300,16 +300,15 @@ BMessageValueNode::CreateChildren()
if (!fChildren.IsEmpty()) if (!fChildren.IsEmpty())
return B_OK; return B_OK;
CompoundType* baseType = dynamic_cast<CompoundType*>( if (fMessageType == NULL)
fType->ResolveRawType(false)); return B_BAD_VALUE;
if (baseType == NULL)
return B_OK;
DataMember* member = NULL; DataMember* member = NULL;
Type* whatType = NULL; Type* whatType = NULL;
for (int32 i = 0; i < baseType->CountDataMembers(); i++) { for (int32 i = 0; i < fMessageType->CountDataMembers(); i++) {
member = baseType->DataMemberAt(i); member = fMessageType->DataMemberAt(i);
if (strcmp(member->Name(), "what") == 0) { if (strcmp(member->Name(), "what") == 0) {
whatType = member->GetType(); whatType = member->GetType();
break; break;
@@ -11,6 +11,9 @@
#include "ValueNode.h" #include "ValueNode.h"
class CompoundType;
class BMessageValueNode : public ValueNode { class BMessageValueNode : public ValueNode {
public: public:
BMessageValueNode(ValueNodeChild* nodeChild, BMessageValueNode(ValueNodeChild* nodeChild,
@@ -18,7 +21,6 @@ public:
virtual ~BMessageValueNode(); virtual ~BMessageValueNode();
virtual Type* GetType() const; virtual Type* GetType() const;
virtual status_t ResolvedLocationAndValue( virtual status_t ResolvedLocationAndValue(
ValueLoader* valueLoader, ValueLoader* valueLoader,
ValueLocation*& _location, ValueLocation*& _location,
@@ -30,6 +32,9 @@ public:
virtual int32 CountChildren() const; virtual int32 CountChildren() const;
virtual ValueNodeChild* ChildAt(int32 index) const; virtual ValueNodeChild* ChildAt(int32 index) const;
CompoundType* GetMessageType() const
{ return fMessageType; }
private: private:
class BMessageFieldHeaderNode; class BMessageFieldHeaderNode;
class BMessageFieldHeaderNodeChild; class BMessageFieldHeaderNodeChild;
@@ -42,6 +47,7 @@ private:
private: private:
Type* fType; Type* fType;
CompoundType* fMessageType;
BMessage fMessage; BMessage fMessage;
ChildNodeList fChildren; ChildNodeList fChildren;
}; };