| 11393 | } |
| 11394 | |
| 11395 | BfMethodInstance* BfModule::GetUnspecializedMethodInstance(BfMethodInstance* methodInstance, bool useUnspecializedType) |
| 11396 | { |
| 11397 | if ((methodInstance->mMethodInfoEx != NULL) && (methodInstance->mMethodInfoEx->mMethodGenericArguments.size() != 0)) |
| 11398 | methodInstance = methodInstance->mMethodInstanceGroup->mDefault; |
| 11399 | |
| 11400 | auto owner = methodInstance->mMethodInstanceGroup->mOwner; |
| 11401 | |
| 11402 | if (!useUnspecializedType) |
| 11403 | return methodInstance; |
| 11404 | |
| 11405 | if (!owner->IsGenericTypeInstance()) |
| 11406 | return methodInstance; |
| 11407 | |
| 11408 | if ((owner->IsDelegateFromTypeRef()) || |
| 11409 | (owner->IsFunctionFromTypeRef()) || |
| 11410 | (owner->IsTuple())) |
| 11411 | { |
| 11412 | return methodInstance; |
| 11413 | } |
| 11414 | |
| 11415 | auto genericType = (BfTypeInstance*)owner; |
| 11416 | if ((genericType->IsUnspecializedType()) && (!genericType->IsUnspecializedTypeVariation())) |
| 11417 | return methodInstance; |
| 11418 | |
| 11419 | if (methodInstance->mMethodDef->mIsLocalMethod) |
| 11420 | return methodInstance; |
| 11421 | if (methodInstance->mMethodDef->mDeclaringType->IsEmitted()) |
| 11422 | return methodInstance; |
| 11423 | |
| 11424 | auto unspecializedType = ResolveTypeDef(genericType->mTypeDef->GetDefinition()); |
| 11425 | if (unspecializedType == NULL) |
| 11426 | { |
| 11427 | AssertErrorState(); |
| 11428 | return methodInstance; |
| 11429 | } |
| 11430 | if (unspecializedType == NULL) |
| 11431 | return methodInstance; |
| 11432 | auto unspecializedTypeInst = unspecializedType->ToTypeInstance(); |
| 11433 | return GetRawMethodInstanceAtIdx(unspecializedTypeInst, methodInstance->mMethodDef->mIdx); |
| 11434 | } |
| 11435 | |
| 11436 | int BfModule::GetGenericParamAndReturnCount(BfMethodInstance* methodInstance) |
| 11437 | { |
no test coverage detected