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

Method GetMethodInstanceAtIdx

IDEHelper/Compiler/BfModule.cpp:11551–11590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11549}
11550
11551BfModuleMethodInstance BfModule::GetMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName, BfGetMethodInstanceFlags flags)
11552{
11553 if (assertName != NULL)
11554 {
11555 BF_ASSERT(typeInstance->mTypeDef->mMethods[methodIdx]->mName == assertName);
11556 }
11557
11558 PopulateType(typeInstance, BfPopulateType_DataAndMethods);
11559
11560 if (methodIdx >= typeInstance->mMethodInstanceGroups.mSize)
11561 return BfModuleMethodInstance();
11562
11563 auto methodInstance = typeInstance->mMethodInstanceGroups[methodIdx].mDefault;
11564
11565 BfMethodDef* methodDef = NULL;
11566 BfTypeInstance* foreignType = NULL;
11567 if (methodInstance != NULL)
11568 {
11569 methodDef = methodInstance->mMethodDef;
11570 if (methodInstance->mMethodInfoEx != NULL)
11571 foreignType = methodInstance->mMethodInfoEx->mForeignType;
11572 }
11573
11574 if ((methodInstance != NULL) && (mIsReified) && (!methodInstance->mIsReified))
11575 {
11576 // Can't use it, not reified
11577 methodInstance = NULL;
11578 }
11579
11580 if ((methodInstance != NULL) && (mBfIRBuilder != NULL) && (mBfIRBuilder->mIgnoreWrites) &&
11581 (methodInstance->mMethodInstanceGroup->IsImplemented()))
11582 {
11583 BfIRFunction func(mBfIRBuilder->GetFakeVal());
11584 return BfModuleMethodInstance(methodInstance, func);
11585 }
11586
11587 if (foreignType != NULL)
11588 return GetMethodInstance(typeInstance, methodDef, BfTypeVector(), (BfGetMethodInstanceFlags)(flags | BfGetMethodInstanceFlag_ForeignMethodDef), foreignType);
11589 return GetMethodInstance(typeInstance, typeInstance->mTypeDef->mMethods[methodIdx], BfTypeVector(), flags);
11590}
11591
11592BfModuleMethodInstance BfModule::GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, int paramCount, bool checkBase)
11593{

Callers 4

DoObjectCreateMethod · 0.80
CreateVDataMethod · 0.80
PopulateReifiedMethod · 0.80

Calls 3

IsImplementedMethod · 0.80
GetFakeValMethod · 0.80

Tested by

no test coverage detected