mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
mCurTypeInstance NULL check
This commit is contained in:
parent
c18c76b4fe
commit
f4ef2d1fbf
1 changed files with 24 additions and 20 deletions
|
@ -3429,31 +3429,35 @@ int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHa
|
|||
|
||||
if (typeDef->mGenericParamDefs.size() != 0)
|
||||
{
|
||||
BfTypeDef* commonOuterType = NULL;
|
||||
|
||||
auto checkTypeInstance = ctx->mModule->mCurTypeInstance;
|
||||
if (checkTypeInstance->IsBoxed())
|
||||
checkTypeInstance = checkTypeInstance->GetUnderlyingType()->ToTypeInstance();
|
||||
|
||||
auto outerType = ctx->mModule->mSystem->GetOuterTypeNonPartial(typeDef);
|
||||
|
||||
BfTypeDef* commonOuterType;
|
||||
if (typeRef == ctx->mRootTypeRef)
|
||||
commonOuterType = FindRootCommonOuterType(outerType, ctx, checkTypeInstance);
|
||||
else
|
||||
commonOuterType = ctx->mModule->FindCommonOuterType(ctx->mModule->mCurTypeInstance->mTypeDef, outerType);
|
||||
|
||||
if ((commonOuterType == NULL) && (outerType != NULL))
|
||||
if (checkTypeInstance != NULL)
|
||||
{
|
||||
auto staticSearch = ctx->mModule->GetStaticSearch();
|
||||
if (staticSearch != NULL)
|
||||
if (checkTypeInstance->IsBoxed())
|
||||
checkTypeInstance = checkTypeInstance->GetUnderlyingType()->ToTypeInstance();
|
||||
|
||||
auto outerType = ctx->mModule->mSystem->GetOuterTypeNonPartial(typeDef);
|
||||
|
||||
if (typeRef == ctx->mRootTypeRef)
|
||||
commonOuterType = FindRootCommonOuterType(outerType, ctx, checkTypeInstance);
|
||||
else
|
||||
commonOuterType = ctx->mModule->FindCommonOuterType(ctx->mModule->mCurTypeInstance->mTypeDef, outerType);
|
||||
|
||||
if ((commonOuterType == NULL) && (outerType != NULL))
|
||||
{
|
||||
for (auto staticTypeInst : staticSearch->mStaticTypes)
|
||||
auto staticSearch = ctx->mModule->GetStaticSearch();
|
||||
if (staticSearch != NULL)
|
||||
{
|
||||
auto foundOuterType = ctx->mModule->FindCommonOuterType(staticTypeInst->mTypeDef, outerType);
|
||||
if ((foundOuterType != NULL) &&
|
||||
((commonOuterType == NULL) || (foundOuterType->mNestDepth > commonOuterType->mNestDepth)))
|
||||
for (auto staticTypeInst : staticSearch->mStaticTypes)
|
||||
{
|
||||
commonOuterType = foundOuterType;
|
||||
checkTypeInstance = staticTypeInst;
|
||||
auto foundOuterType = ctx->mModule->FindCommonOuterType(staticTypeInst->mTypeDef, outerType);
|
||||
if ((foundOuterType != NULL) &&
|
||||
((commonOuterType == NULL) || (foundOuterType->mNestDepth > commonOuterType->mNestDepth)))
|
||||
{
|
||||
commonOuterType = foundOuterType;
|
||||
checkTypeInstance = staticTypeInst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue