mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added error for conflicting extension override methods
This commit is contained in:
parent
bc46807003
commit
9d9cd528da
1 changed files with 28 additions and 1 deletions
|
@ -22261,6 +22261,8 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
{
|
{
|
||||||
if ((methodDef->mIsOverride) && (mCurTypeInstance->mTypeDef->mIsCombinedPartial))
|
if ((methodDef->mIsOverride) && (mCurTypeInstance->mTypeDef->mIsCombinedPartial))
|
||||||
{
|
{
|
||||||
|
bool takeover = false;
|
||||||
|
|
||||||
mCurTypeInstance->mTypeDef->PopulateMemberSets();
|
mCurTypeInstance->mTypeDef->PopulateMemberSets();
|
||||||
BfMethodDef* nextMethod = NULL;
|
BfMethodDef* nextMethod = NULL;
|
||||||
BfMemberSetEntry* entry = NULL;
|
BfMemberSetEntry* entry = NULL;
|
||||||
|
@ -22273,6 +22275,28 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
|
|
||||||
if (checkMethod == methodDef)
|
if (checkMethod == methodDef)
|
||||||
continue;
|
continue;
|
||||||
|
if (checkMethod->mIsOverride)
|
||||||
|
{
|
||||||
|
auto checkMethodInstance = mCurTypeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;
|
||||||
|
if (checkMethodInstance == NULL)
|
||||||
|
continue;
|
||||||
|
if (checkMethodInstance->mIRFunction == prevFunc)
|
||||||
|
{
|
||||||
|
BfAstNode* refNode = methodDef->GetRefNode();
|
||||||
|
if (auto propertyMethodDeclaration = methodDef->GetPropertyMethodDeclaration())
|
||||||
|
refNode = propertyMethodDeclaration->mPropertyDeclaration->mVirtualSpecifier;
|
||||||
|
else if (auto methodDeclaration = methodDef->GetMethodDeclaration())
|
||||||
|
refNode = methodDeclaration->mVirtualSpecifier;
|
||||||
|
|
||||||
|
auto error = Fail(StrFormat("Conflicting extension override method '%s'", MethodToString(mCurMethodInstance).c_str()), refNode);
|
||||||
|
if (error != NULL)
|
||||||
|
mCompiler->mPassInstance->MoreInfo("See previous override", checkMethod->GetRefNode());
|
||||||
|
|
||||||
|
takeover = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkMethod->mIsExtern)
|
if (!checkMethod->mIsExtern)
|
||||||
continue;
|
continue;
|
||||||
auto checkMethodInstance = mCurTypeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;
|
auto checkMethodInstance = mCurTypeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;
|
||||||
|
@ -22281,8 +22305,11 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
if (!CompareMethodSignatures(checkMethodInstance, mCurMethodInstance))
|
if (!CompareMethodSignatures(checkMethodInstance, mCurMethodInstance))
|
||||||
continue;
|
continue;
|
||||||
// Take over function
|
// Take over function
|
||||||
mCurMethodInstance->mIRFunction = prevFunc;
|
takeover = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (takeover)
|
||||||
|
mCurMethodInstance->mIRFunction = prevFunc;
|
||||||
|
|
||||||
if (!mCurMethodInstance->mIRFunction)
|
if (!mCurMethodInstance->mIRFunction)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue