MCPcopy Create free account
hub / github.com/beefytech/Beef / FindRootCommonOuterType

Method FindRootCommonOuterType

IDEHelper/Compiler/BfResolvedTypeUtils.cpp:3647–3686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3645}
3646
3647BfTypeDef* BfResolvedTypeSet::FindRootCommonOuterType(BfTypeDef* outerType, LookupContext* ctx, BfTypeInstance*& outOuterTypeInstance)
3648{
3649 if (ctx->mModule->mCurTypeInstance == NULL)
3650 return NULL;
3651
3652 BfTypeDef* commonOuterType = NULL;
3653
3654 auto checkOuterTypeInst = ctx->mModule->mCurTypeInstance;
3655 while (checkOuterTypeInst != NULL)
3656 {
3657 commonOuterType = ctx->mModule->FindCommonOuterType(checkOuterTypeInst->mTypeDef, outerType);
3658 if (commonOuterType != NULL)
3659 {
3660 outOuterTypeInstance = checkOuterTypeInst;
3661 break;
3662 }
3663 checkOuterTypeInst = checkOuterTypeInst->mBaseType;
3664 }
3665
3666 if ((commonOuterType == NULL) && (outerType != NULL))
3667 {
3668 auto staticSearch = ctx->mModule->GetStaticSearch();
3669 if (staticSearch != NULL)
3670 {
3671 for (auto staticTypeInst : staticSearch->mStaticTypes)
3672 {
3673 auto foundOuterType = ctx->mModule->FindCommonOuterType(staticTypeInst->mTypeDef, outerType);
3674 if ((foundOuterType != NULL) &&
3675 ((commonOuterType == NULL) || (foundOuterType->mNestDepth > commonOuterType->mNestDepth)))
3676 {
3677 commonOuterType = foundOuterType;
3678 outOuterTypeInstance = staticTypeInst;
3679 }
3680 }
3681 }
3682 }
3683 if (outOuterTypeInstance != NULL)
3684 ctx->mRootOuterTypeInstance = outOuterTypeInstance;
3685 return commonOuterType;
3686}
3687
3688int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHashFlags flags, int& hashSeed)
3689{

Callers

nothing calls this directly

Calls 2

FindCommonOuterTypeMethod · 0.80
GetStaticSearchMethod · 0.80

Tested by

no test coverage detected