| 26138 | } |
| 26139 | |
| 26140 | bool BfModule::SlotVirtualMethod(BfMethodInstance* methodInstance, BfAmbiguityContext* ambiguityContext) |
| 26141 | { |
| 26142 | BP_ZONE("BfModule::SlotVirtualMethod"); |
| 26143 | |
| 26144 | if (mCurTypeInstance->IsUnspecializedTypeVariation()) |
| 26145 | return false; |
| 26146 | |
| 26147 | auto _AddVirtualDecl = [&](BfMethodInstance* declMethodInstance) |
| 26148 | { |
| 26149 | if (!mCompiler->mOptions.mAllowHotSwapping) |
| 26150 | return; |
| 26151 | if ((!methodInstance->mIsReified) || (!declMethodInstance->mIsReified)) |
| 26152 | return; |
| 26153 | |
| 26154 | if (methodInstance->mHotMethod == NULL) |
| 26155 | CheckHotMethod(methodInstance, ""); |
| 26156 | |
| 26157 | if (methodInstance->mHotMethod == NULL) |
| 26158 | return; |
| 26159 | |
| 26160 | //BF_ASSERT(declMethodInstance->mHotMethod != NULL); |
| 26161 | if (declMethodInstance->mHotMethod == NULL) |
| 26162 | CheckHotMethod(declMethodInstance, ""); |
| 26163 | auto virtualDecl = mCompiler->mHotData->GetVirtualDeclaration(declMethodInstance->mHotMethod); |
| 26164 | virtualDecl->mRefCount++; |
| 26165 | methodInstance->mHotMethod->mReferences.Add(virtualDecl); |
| 26166 | }; |
| 26167 | |
| 26168 | auto typeInstance = mCurTypeInstance; |
| 26169 | auto typeDef = typeInstance->mTypeDef; |
| 26170 | auto methodDef = methodInstance->mMethodDef; |
| 26171 | auto methodDeclaration = methodDef->GetMethodDeclaration(); |
| 26172 | auto propertyDeclaration = methodDef->GetPropertyDeclaration(); |
| 26173 | auto propertyMethodDeclaration = methodDef->GetPropertyMethodDeclaration(); |
| 26174 | |
| 26175 | if (methodInstance->mIsInnerOverride) |
| 26176 | return false; |
| 26177 | |
| 26178 | BfAstNode* declaringNode = methodDeclaration; |
| 26179 | if (propertyMethodDeclaration != NULL) |
| 26180 | declaringNode = propertyMethodDeclaration->mNameNode; |
| 26181 | |
| 26182 | BfMethodInstance* methodOverriden = NULL; |
| 26183 | bool usedMethod = false; |
| 26184 | |
| 26185 | BfTokenNode* virtualToken = NULL; |
| 26186 | if (propertyDeclaration != NULL) |
| 26187 | virtualToken = propertyDeclaration->mVirtualSpecifier; |
| 26188 | else if (methodDeclaration != NULL) |
| 26189 | virtualToken = methodDeclaration->mVirtualSpecifier; |
| 26190 | |
| 26191 | if ((methodDef->mIsVirtual) && (methodDef->mIsStatic)) |
| 26192 | { |
| 26193 | //Fail: Static members cannot be marked as override, virtual, or abstract |
| 26194 | } |
| 26195 | else if (methodDef->mIsVirtual) |
| 26196 | { |
| 26197 | if (IsHotCompile()) |
nothing calls this directly
no test coverage detected