1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed constraints on generic delegates

This commit is contained in:
Brian Fiete 2024-02-06 06:56:10 -05:00
parent b722614501
commit 6302416e40
2 changed files with 18 additions and 3 deletions

View file

@ -8445,12 +8445,18 @@ void BfCompiler::GenerateAutocompleteInfo()
if (checkMethodInstance->GetNumGenericParams() == 0)
checkMethodInstance = methodEntry.mCurMethodInstance;
bool handled = false;
if (genericParamType->mGenericParamIdx < checkMethodInstance->GetNumGenericParams())
{
auto genericParamInstance = checkMethodInstance->mMethodInfoEx->mGenericParams[genericParamType->mGenericParamIdx];
methodText += genericParamInstance->GetGenericParamDef()->mName;
auto genericParamDef = genericParamInstance->GetGenericParamDef();
if (genericParamDef != NULL)
{
methodText += genericParamDef->mName;
handled = true;
}
else
}
if (!handled)
{
methodText += StrFormat("@M%d", genericParamType->mGenericParamIdx);
}

View file

@ -8866,7 +8866,16 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
}
}
if (!ParseMethod(methodDecl, &params, &commas))
bool failed = ParseMethod(methodDecl, &params, &commas);
if (methodDecl->mGenericConstraintsDeclaration != NULL)
{
typeDeclaration->mGenericConstraintsDeclaration = methodDecl->mGenericConstraintsDeclaration;
typeDeclaration->SetSrcEnd(methodDecl->GetSrcEnd());
methodDecl->mGenericConstraintsDeclaration = NULL;
}
if (failed)
return typeDeclaration;
if (methodDecl->mEndSemicolon == NULL)