1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed 'new' method specifier in extensions for generic types

This commit is contained in:
Brian Fiete 2021-01-22 09:53:21 -08:00
parent fc66c7757b
commit 7093476126

View file

@ -22368,7 +22368,12 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
auto checkMethodInstance = typeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault; auto checkMethodInstance = typeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;
if (checkMethodInstance == NULL) if (checkMethodInstance == NULL)
continue; {
if ((methodDef->mIsNew) && (methodDef->mDeclaringType->IsExtension()) && (!checkMethod->mDeclaringType->IsExtension()))
checkMethodInstance = GetRawMethodInstanceAtIdx(typeInstance, checkMethod->mIdx);
if (checkMethodInstance == NULL)
continue;
}
if (((checkMethodInstance->mChainType == BfMethodChainType_None) || (checkMethodInstance->mChainType == BfMethodChainType_ChainHead)) && if (((checkMethodInstance->mChainType == BfMethodChainType_None) || (checkMethodInstance->mChainType == BfMethodChainType_ChainHead)) &&
(checkMethodInstance->GetExplicitInterface() == methodInstance->GetExplicitInterface()) && (checkMethodInstance->GetExplicitInterface() == methodInstance->GetExplicitInterface()) &&
@ -22436,7 +22441,9 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
if ((methodDef->mMethodType == BfMethodType_Ctor) && (methodDef->mIsStatic)) if ((methodDef->mMethodType == BfMethodType_Ctor) && (methodDef->mIsStatic))
silentlyAllow = true; silentlyAllow = true;
else if (methodDef->mIsNew) else if (methodDef->mIsNew)
{
silentlyAllow = true; silentlyAllow = true;
}
else else
extensionWarn = true; extensionWarn = true;
} }
@ -22477,9 +22484,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
{ {
auto baseType = typeInstance->mBaseType; auto baseType = typeInstance->mBaseType;
while (baseType != NULL) while (baseType != NULL)
{ {
//for (int checkMethodIdx = 0; checkMethodIdx < (int) baseType->mTypeDef->mMethods.size(); checkMethodIdx++)
auto baseTypeDef = baseType->mTypeDef; auto baseTypeDef = baseType->mTypeDef;
baseTypeDef->PopulateMemberSets(); baseTypeDef->PopulateMemberSets();
BfMethodDef* checkMethod = NULL; BfMethodDef* checkMethod = NULL;
@ -22533,8 +22538,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
baseType = baseType->mBaseType; baseType = baseType->mBaseType;
} }
if ((methodDef->mIsNew) && (!foundHiddenMethod) && (!mCurTypeInstance->IsSpecializedType()))
if ((methodDef->mIsNew) && (!foundHiddenMethod))
{ {
auto propertyDeclaration = methodDef->GetPropertyDeclaration(); auto propertyDeclaration = methodDef->GetPropertyDeclaration();
auto tokenNode = (propertyDeclaration != NULL) ? propertyDeclaration->mNewSpecifier : auto tokenNode = (propertyDeclaration != NULL) ? propertyDeclaration->mNewSpecifier :