| 14178 | } |
| 14179 | |
| 14180 | bool BfModule::CompareMethodSignatures(BfMethodInstance* methodA, BfMethodInstance* methodB) |
| 14181 | { |
| 14182 | // If one is an interface and the other is an impl, B is the impl |
| 14183 | auto implOwner = methodB->GetOwner(); |
| 14184 | |
| 14185 | if (methodA->mMethodDef->mIsLocalMethod) |
| 14186 | { |
| 14187 | int sepPosA = (int)BF_MIN(methodA->mMethodDef->mName.IndexOf('@'), methodA->mMethodDef->mName.length()); |
| 14188 | int sepPosB = (int)BF_MIN(methodB->mMethodDef->mName.IndexOf('@'), methodB->mMethodDef->mName.length()); |
| 14189 | if (sepPosA != sepPosB) |
| 14190 | return false; |
| 14191 | if (strncmp(methodA->mMethodDef->mName.c_str(), methodB->mMethodDef->mName.c_str(), sepPosA) != 0) |
| 14192 | return false; |
| 14193 | } |
| 14194 | else if (methodA->mMethodDef->mName != methodB->mMethodDef->mName) |
| 14195 | return false; |
| 14196 | if (methodA->mMethodDef->mAppendKind != methodB->mMethodDef->mAppendKind) |
| 14197 | return false; |
| 14198 | if (methodA->mMethodDef->mCheckedKind != methodB->mMethodDef->mCheckedKind) |
| 14199 | return false; |
| 14200 | if (methodA->mMethodDef->mHasComptime != methodB->mMethodDef->mHasComptime) |
| 14201 | return false; |
| 14202 | if ((methodA->mMethodDef->mMethodType == BfMethodType_Mixin) != (methodB->mMethodDef->mMethodType == BfMethodType_Mixin)) |
| 14203 | return false; |
| 14204 | |
| 14205 | if (methodA->mMethodDef->mMethodType == BfMethodType_Ctor) |
| 14206 | { |
| 14207 | if (methodA->mMethodDef->mIsStatic != methodB->mMethodDef->mIsStatic) |
| 14208 | return false; |
| 14209 | } |
| 14210 | |
| 14211 | if (methodA->mMethodDef->mMethodType == BfMethodType_Operator) |
| 14212 | { |
| 14213 | if (methodB->mMethodDef->mMethodType != BfMethodType_Operator) |
| 14214 | return false; |
| 14215 | auto operatorA = (BfOperatorDef*)methodA->mMethodDef; |
| 14216 | auto operatorB = (BfOperatorDef*)methodB->mMethodDef; |
| 14217 | if (operatorA->mOperatorDeclaration->mUnaryOp != operatorB->mOperatorDeclaration->mUnaryOp) |
| 14218 | return false; |
| 14219 | if (operatorA->mOperatorDeclaration->mBinOp != operatorB->mOperatorDeclaration->mBinOp) |
| 14220 | return false; |
| 14221 | if (operatorA->mOperatorDeclaration->mAssignOp != operatorB->mOperatorDeclaration->mAssignOp) |
| 14222 | return false; |
| 14223 | if (operatorA->mOperatorDeclaration->mIsConvOperator) |
| 14224 | { |
| 14225 | if (!BfTypeUtils::TypeEquals(methodA->mReturnType, methodB->mReturnType, implOwner)) |
| 14226 | return false; |
| 14227 | } |
| 14228 | } |
| 14229 | |
| 14230 | int implicitParamCountA = methodA->GetImplicitParamCount(); |
| 14231 | int implicitParamCountB = methodB->GetImplicitParamCount(); |
| 14232 | |
| 14233 | if (methodA->GetParamCount() - implicitParamCountA != methodB->GetParamCount() - implicitParamCountB) |
| 14234 | return false; |
| 14235 | |
| 14236 | if (methodA->mHadGenericDelegateParams != methodB->mHadGenericDelegateParams) |
| 14237 | return false; |
no test coverage detected