| 11275 | } |
| 11276 | |
| 11277 | BfMethodInstance* BfModule::GetRawMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName) |
| 11278 | { |
| 11279 | if (typeInstance->IsDeleting()) |
| 11280 | { |
| 11281 | mCompiler->RequestExtraCompile(); |
| 11282 | InternalError("GetRawMethodInstanceAtIdx for deleted type", typeInstance->mTypeDef->GetRefNode()); |
| 11283 | return NULL; |
| 11284 | } |
| 11285 | |
| 11286 | if (!typeInstance->mResolvingVarField) |
| 11287 | { |
| 11288 | if (!typeInstance->DefineStateAllowsStaticMethods()) |
| 11289 | PopulateType(typeInstance, BfPopulateType_AllowStaticMethods); |
| 11290 | } |
| 11291 | else |
| 11292 | { |
| 11293 | if (methodIdx >= (int)typeInstance->mMethodInstanceGroups.size()) |
| 11294 | { |
| 11295 | AssertErrorState(); |
| 11296 | return NULL; |
| 11297 | } |
| 11298 | } |
| 11299 | |
| 11300 | if (assertName != NULL) |
| 11301 | { |
| 11302 | BF_ASSERT(typeInstance->mTypeDef->mMethods[methodIdx]->mName == assertName); |
| 11303 | } |
| 11304 | |
| 11305 | if (methodIdx >= typeInstance->mMethodInstanceGroups.mSize) |
| 11306 | { |
| 11307 | if (mCompiler->EnsureCeUnpaused(typeInstance)) |
| 11308 | { |
| 11309 | InternalError("OOB in GetRawMethodInstanceAtIdx"); |
| 11310 | } |
| 11311 | return NULL; |
| 11312 | } |
| 11313 | |
| 11314 | auto& methodGroup = typeInstance->mMethodInstanceGroups[methodIdx]; |
| 11315 | if (methodGroup.mDefault == NULL) |
| 11316 | { |
| 11317 | if (!mCompiler->mIsResolveOnly) |
| 11318 | { |
| 11319 | // Get it from the owning module so we don't create a reference prematurely... |
| 11320 | auto declModule = typeInstance->mModule; |
| 11321 | |
| 11322 | if ((typeInstance->mGenericTypeInfo != NULL) && (typeInstance->mGenericTypeInfo->mFinishedGenericParams) && (methodGroup.mOnDemandKind == BfMethodOnDemandKind_NotSet)) |
| 11323 | { |
| 11324 | methodGroup.mOnDemandKind = BfMethodOnDemandKind_NoDecl_AwaitingReference; |
| 11325 | if (!declModule->mIsScratchModule) |
| 11326 | declModule->mOnDemandMethodCount++; |
| 11327 | } |
| 11328 | |
| 11329 | BF_ASSERT((methodGroup.mOnDemandKind == BfMethodOnDemandKind_AlwaysInclude) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl) || |
| 11330 | (typeInstance->mTypeFailed) || (typeInstance->mDefineState < BfTypeDefineState_DefinedAndMethodsSlotted)); |
| 11331 | if ((methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) || (methodGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingDecl)) |
| 11332 | methodGroup.mOnDemandKind = BfMethodOnDemandKind_Decl_AwaitingDecl; |
| 11333 | |
| 11334 | BfGetMethodInstanceFlags useFlags = (BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_MethodInstanceOnly | BfGetMethodInstanceFlag_UnspecializedPass | BfGetMethodInstanceFlag_Unreified); |
no test coverage detected