| 10331 | } |
| 10332 | |
| 10333 | BfTypeDef* BfModule::GetActiveTypeDef(BfTypeInstance* typeInstanceOverride, bool useMixinDecl, bool useForeignImpl) |
| 10334 | { |
| 10335 | BfTypeDef* useTypeDef = NULL; |
| 10336 | BfTypeInstance* typeInstance = (typeInstanceOverride != NULL) ? typeInstanceOverride : mCurTypeInstance; |
| 10337 | |
| 10338 | auto curTypeState = mContext->mCurTypeState; |
| 10339 | if (curTypeState != NULL) |
| 10340 | { |
| 10341 | if ((curTypeState->mType != NULL) && (curTypeState->mType != typeInstance)) |
| 10342 | curTypeState = NULL; |
| 10343 | } |
| 10344 | |
| 10345 | if ((curTypeState != NULL) && (curTypeState->mForceActiveTypeDef != NULL)) |
| 10346 | return curTypeState->mForceActiveTypeDef; |
| 10347 | if (typeInstance != NULL) |
| 10348 | useTypeDef = typeInstance->mTypeDef->GetDefinition(); |
| 10349 | if ((mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL) && (useMixinDecl)) |
| 10350 | useTypeDef = mCurMethodState->mMixinState->mMixinMethodInstance->mMethodDef->mDeclaringType->GetDefinition(); |
| 10351 | else if ((mCurMethodInstance != NULL) && (mCurMethodInstance->mMethodDef->mDeclaringType != NULL)) |
| 10352 | { |
| 10353 | if ((mCurMethodInstance->mIsForeignMethodDef) && (useForeignImpl)) |
| 10354 | { |
| 10355 | // Use the concrete impl typeDef, not the foreign method typedecl (the interface) |
| 10356 | } |
| 10357 | else |
| 10358 | { |
| 10359 | auto declTypeDef = mCurMethodInstance->mMethodDef->mDeclaringType; |
| 10360 | useTypeDef = declTypeDef->GetDefinition(true); |
| 10361 | if ((declTypeDef->IsEmitted()) && (useTypeDef->mIsCombinedPartial)) |
| 10362 | { |
| 10363 | // Always consider methods to belong to the primary type declaration |
| 10364 | useTypeDef = useTypeDef->mPartials[0]; |
| 10365 | |
| 10366 | } |
| 10367 | } |
| 10368 | } |
| 10369 | else if (curTypeState != NULL) |
| 10370 | { |
| 10371 | if ((curTypeState->mCurFieldDef != NULL) && (curTypeState->mCurFieldDef->mDeclaringType != NULL)) |
| 10372 | useTypeDef = curTypeState->mCurFieldDef->mDeclaringType->GetDefinition(true); |
| 10373 | else if (curTypeState->mCurTypeDef != NULL) |
| 10374 | useTypeDef = curTypeState->mCurTypeDef->GetDefinition(true); |
| 10375 | } |
| 10376 | |
| 10377 | return useTypeDef; |
| 10378 | } |
| 10379 | |
| 10380 | BfTypeDef* BfModule::FindTypeDefRaw(const BfAtomComposite& findName, int numGenericArgs, BfTypeInstance* typeInstance, BfTypeDef* useTypeDef, BfTypeLookupError* error, BfTypeLookupResultCtx* lookupResultCtx, BfResolveTypeRefFlags resolveFlags) |
| 10381 | { |
no test coverage detected