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

Method GetLocalMethodInstance

IDEHelper/Compiler/BfModule.cpp:23403–24085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23401}
23402
23403BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMethod, const BfTypeVector& methodGenericArguments, BfMethodInstance* methodInstance, bool force)
23404{
23405 BP_ZONE_F("GetLocalMethodInstance %s", localMethod->mMethodName.c_str());
23406
23407 BfLogSysM("GetLocalMethodInstance %p\n", localMethod);
23408
23409 auto rootMethodState = mCurMethodState->GetRootMethodState();
23410 auto declMethodState = localMethod->mDeclMethodState;
23411 auto declMixinState = localMethod->mDeclMixinState;
23412 auto callerMethodState = mCurMethodState;
23413
23414 auto typeInst = mCurTypeInstance;
23415
23416 if (mCurMethodState->mMixinState != NULL)
23417 {
23418 typeInst = mCurMethodState->mMixinState->mMixinMethodInstance->GetOwner();
23419 }
23420
23421 auto methodDef = GetLocalMethodDef(localMethod);
23422
23423 BfAstNode* body = NULL;
23424
23425 auto methodDeclaration = localMethod->mMethodDeclaration;
23426 if (methodDeclaration != NULL)
23427 {
23428 body = methodDeclaration->mBody;
23429 }
23430 else
23431 {
23432 body = localMethod->mLambdaBindExpr->mBody;
23433 }
23434
23435 bool hadConcreteInterfaceGenericArgument = false;
23436
23437 BfTypeVector sanitizedMethodGenericArguments;
23438
23439 // Ignore the outermost method's generic method arguments for the purpose of determining if we are the 'default' (ie: unspecialized)
23440 // version of this method for this pass through the outermost method
23441 int dependentGenericStartIdx = 0;
23442 if ((rootMethodState->mMethodInstance != NULL) && (rootMethodState->mMethodInstance->mMethodInfoEx != NULL))
23443 dependentGenericStartIdx = (int)rootMethodState->mMethodInstance->mMethodInfoEx->mMethodGenericArguments.size();
23444
23445 BfMethodInstance* outerMethodInstance = mCurMethodInstance;
23446
23447 if (methodGenericArguments.size() == 0)
23448 {
23449 if ((rootMethodState->mMethodInstance != NULL) && (rootMethodState->mMethodInstance->mMethodInfoEx != NULL))
23450 sanitizedMethodGenericArguments = rootMethodState->mMethodInstance->mMethodInfoEx->mMethodGenericArguments;
23451 }
23452 else
23453 {
23454 int genericArgIdx = 0;
23455// for (; genericArgIdx < (int)outerMethodInstance->mMethodGenericArguments.size(); genericArgIdx++)
23456// {
23457// BF_ASSERT(methodGenericArguments[genericArgIdx] == outerMethodInstance->mMethodGenericArguments[genericArgIdx]);
23458// sanitizedMethodGenericArguments.push_back(methodGenericArguments[genericArgIdx]);
23459// }
23460

Callers 1

GetLambdaInstanceMethod · 0.80

Calls 15

FailFunction · 0.85
GetRootMethodStateMethod · 0.80
GetMethodInfoExMethod · 0.80
GetNumGenericParamsMethod · 0.80
MapTypeMethod · 0.80
IsVarArgsMethod · 0.80
SaveDebugLocationMethod · 0.80
GetActiveFunctionMethod · 0.80
GetSourceDataMethod · 0.80
DoMethodDeclarationMethod · 0.80
GetMethodDeclarationMethod · 0.80

Tested by

no test coverage detected