1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fix extern method constraints that end up not being extern

This commit is contained in:
Brian Fiete 2022-02-12 14:57:26 -05:00
parent a277fa18cf
commit 1b7dbd7288
2 changed files with 26 additions and 2 deletions

View file

@ -8451,6 +8451,9 @@ BfGenericParamInstance* BfModule::GetGenericTypeParamInstance(int genericParamId
if (genericParamIdx >= (int)genericTypeInst->mGenericTypeInfo->mTypeGenericArguments.size())
{
if (genericParamIdx >= genericTypeInst->mGenericTypeInfo->mGenericParams.mSize)
FatalError("Invalid GetGenericTypeParamInstance");
// Extern constraints should always be directly used - they don't get extended
return genericTypeInst->mGenericTypeInfo->mGenericParams[genericParamIdx];
}
@ -8473,7 +8476,7 @@ BfGenericParamInstance* BfModule::GetGenericTypeParamInstance(int genericParamId
{
if ((mCompiler->mResolvePassData == NULL) || (mCompiler->mResolvePassData->mAutoComplete == NULL))
{
BFMODULE_FATAL(this, "Invalid GetGenericParamInstance with extension");
FatalError("Invalid GetGenericParamInstance with extension");
}
}
}
@ -8562,7 +8565,12 @@ BfGenericParamInstance* BfModule::GetMergedGenericParamData(BfGenericParamType*
BfGenericParamInstance* BfModule::GetGenericParamInstance(BfGenericParamType* type)
{
if (type->mGenericParamKind == BfGenericParamKind_Method)
{
{
if ((mCurMethodInstance->mMethodInfoEx == NULL) || (type->mGenericParamIdx >= mCurMethodInstance->mMethodInfoEx->mGenericParams.mSize))
{
FatalError("Invalid GetGenericParamInstance method generic param");
return NULL;
}
return mCurMethodInstance->mMethodInfoEx->mGenericParams[type->mGenericParamIdx];
}