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

Method GetUnspecializedMethodInstance

IDEHelper/Compiler/BfModule.cpp:11395–11434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11393}
11394
11395BfMethodInstance* 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
11436int BfModule::GetGenericParamAndReturnCount(BfMethodInstance* methodInstance)
11437{

Callers 6

BuildMethod · 0.80
CompareMethodsMethod · 0.80
CheckMethodMethod · 0.80
FlushAmbiguityErrorMethod · 0.80
BindGenericTypeMethod · 0.80
GetSelectedMethodMethod · 0.80

Calls 10

GetDefinitionMethod · 0.80
sizeMethod · 0.45
IsGenericTypeInstanceMethod · 0.45
IsDelegateFromTypeRefMethod · 0.45
IsFunctionFromTypeRefMethod · 0.45
IsTupleMethod · 0.45
IsUnspecializedTypeMethod · 0.45
IsEmittedMethod · 0.45
ToTypeInstanceMethod · 0.45

Tested by

no test coverage detected