| 24287 | } |
| 24288 | |
| 24289 | void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& mangledName, bool isTemporaryFunc, bool* outIsIntrinsic) |
| 24290 | { |
| 24291 | if (methodInstance->GetImportCallKind() == BfImportCallKind_GlobalVar) |
| 24292 | { |
| 24293 | // Don't create a func |
| 24294 | return; |
| 24295 | } |
| 24296 | |
| 24297 | auto typeInstance = methodInstance->GetOwner(); |
| 24298 | auto methodDef = methodInstance->mMethodDef; |
| 24299 | |
| 24300 | BfIRFunctionType funcType = mBfIRBuilder->MapMethod(methodInstance); |
| 24301 | |
| 24302 | if (isTemporaryFunc) |
| 24303 | { |
| 24304 | BF_ASSERT(((mCompiler->mIsResolveOnly) && (mCompiler->mResolvePassData->mAutoComplete != NULL)) || |
| 24305 | (methodInstance->GetOwner()->mDefineState < BfTypeDefineState_Defined)); |
| 24306 | mangledName = "autocomplete_tmp"; |
| 24307 | } |
| 24308 | |
| 24309 | if (!mBfIRBuilder->mIgnoreWrites) |
| 24310 | { |
| 24311 | BfIRFunction prevFunc; |
| 24312 | |
| 24313 | // Remove old version (if we have one) |
| 24314 | prevFunc = mBfIRBuilder->GetFunction(mangledName); |
| 24315 | if (prevFunc) |
| 24316 | { |
| 24317 | auto owner = methodInstance->GetOwner(); |
| 24318 | |
| 24319 | if ((methodDef->mIsOverride) && (owner->mTypeDef->mIsCombinedPartial)) |
| 24320 | { |
| 24321 | bool takeover = false; |
| 24322 | |
| 24323 | owner->mTypeDef->PopulateMemberSets(); |
| 24324 | BfMethodDef* nextMethod = NULL; |
| 24325 | BfMemberSetEntry* entry = NULL; |
| 24326 | if (owner->mTypeDef->mMethodSet.TryGet(BfMemberSetEntry(methodDef), &entry)) |
| 24327 | nextMethod = (BfMethodDef*)entry->mMemberDef; |
| 24328 | while (nextMethod != NULL) |
| 24329 | { |
| 24330 | auto checkMethod = nextMethod; |
| 24331 | nextMethod = nextMethod->mNextWithSameName; |
| 24332 | |
| 24333 | if (checkMethod == methodDef) |
| 24334 | continue; |
| 24335 | if (checkMethod->mIsOverride) |
| 24336 | { |
| 24337 | auto checkMethodInstance = owner->mMethodInstanceGroups[checkMethod->mIdx].mDefault; |
| 24338 | if (checkMethodInstance == NULL) |
| 24339 | continue; |
| 24340 | if ((checkMethodInstance->mIRFunction == prevFunc) && |
| 24341 | (checkMethodInstance->mMethodDef->mMethodDeclaration != NULL) && |
| 24342 | (checkMethodInstance->mVirtualTableIdx < 0)) |
| 24343 | { |
| 24344 | BfAstNode* refNode = methodDef->GetRefNode(); |
| 24345 | if (auto propertyMethodDeclaration = methodDef->GetPropertyMethodDeclaration()) |
| 24346 | refNode = propertyMethodDeclaration->mPropertyDeclaration->mVirtualSpecifier; |
nothing calls this directly
no test coverage detected