- set PointedType to null for PClassPointer to simplify the functions for this class.

This commit is contained in:
Christoph Oelckers 2017-04-12 13:11:59 +02:00
parent 6308251084
commit abc4481431
1 changed files with 3 additions and 7 deletions

View File

@ -1625,10 +1625,7 @@ void PClassPointer::SetPointer(void *base, unsigned offset, TArray<size_t> *spec
bool PClassPointer::IsMatch(intptr_t id1, intptr_t id2) const bool PClassPointer::IsMatch(intptr_t id1, intptr_t id2) const
{ {
const PType *pointat = (const PType *)id1;
const PClass *classat = (const PClass *)id2; const PClass *classat = (const PClass *)id2;
assert(pointat->IsKindOf(RUNTIME_CLASS(PClass)));
return classat == ClassRestriction; return classat == ClassRestriction;
} }
@ -1640,8 +1637,7 @@ bool PClassPointer::IsMatch(intptr_t id1, intptr_t id2) const
void PClassPointer::GetTypeIDs(intptr_t &id1, intptr_t &id2) const void PClassPointer::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
{ {
assert(PointedType == RUNTIME_CLASS(PClass)); id1 = 0;
id1 = (intptr_t)PointedType;
id2 = (intptr_t)ClassRestriction; id2 = (intptr_t)ClassRestriction;
} }
@ -1656,11 +1652,11 @@ void PClassPointer::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
PClassPointer *NewClassPointer(PClass *restrict) PClassPointer *NewClassPointer(PClass *restrict)
{ {
size_t bucket; size_t bucket;
PType *ptype = TypeTable.FindType(RUNTIME_CLASS(PClassPointer), (intptr_t)RUNTIME_CLASS(PClass), (intptr_t)restrict, &bucket); PType *ptype = TypeTable.FindType(RUNTIME_CLASS(PClassPointer), 0, (intptr_t)restrict, &bucket);
if (ptype == nullptr) if (ptype == nullptr)
{ {
ptype = new PClassPointer(restrict); ptype = new PClassPointer(restrict);
TypeTable.AddType(ptype, RUNTIME_CLASS(PClassPointer), (intptr_t)RUNTIME_CLASS(PClass), (intptr_t)restrict, bucket); TypeTable.AddType(ptype, RUNTIME_CLASS(PClassPointer), 0, (intptr_t)restrict, bucket);
} }
return static_cast<PClassPointer *>(ptype); return static_cast<PClassPointer *>(ptype);
} }