mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed params/varargs in function/delegate typerefs
This commit is contained in:
parent
a730e782f5
commit
9c9ca4d259
2 changed files with 28 additions and 4 deletions
|
@ -656,7 +656,7 @@ BfMethodDef* BfDefBuilder::CreateMethodDef(BfMethodDeclaration* methodDeclaratio
|
||||||
if (paramIdx == (int)methodDeclaration->mParams.size() - 1)
|
if (paramIdx == (int)methodDeclaration->mParams.size() - 1)
|
||||||
paramDef->mParamKind = BfParamKind_VarArgs;
|
paramDef->mParamKind = BfParamKind_VarArgs;
|
||||||
else
|
else
|
||||||
Fail("Varargs specifier must be the last parameter", methodDef->mParams[paramIdx - 1]->mParamDeclaration);
|
Fail("Varargs specifier must be the last parameter", paramDecl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8730,10 +8730,10 @@ BfType* BfModule::ResolveGenericType(BfType* unspecializedType, BfTypeVector* ty
|
||||||
directTypeRef->Init(paramType);
|
directTypeRef->Init(paramType);
|
||||||
|
|
||||||
BfParameterDef* paramDef = new BfParameterDef();
|
BfParameterDef* paramDef = new BfParameterDef();
|
||||||
|
paramDef->mParamKind = unspecializedParamDef->mParamKind;
|
||||||
paramDef->mTypeRef = directTypeRef;
|
paramDef->mTypeRef = directTypeRef;
|
||||||
paramDef->mName = unspecializedParamDef->mName;
|
paramDef->mName = unspecializedParamDef->mName;
|
||||||
methodDef->mParams.push_back(paramDef);
|
methodDef->mParams.push_back(paramDef);
|
||||||
|
|
||||||
delegateInfo->mParams.Add(paramType);
|
delegateInfo->mParams.Add(paramType);
|
||||||
}
|
}
|
||||||
|
@ -11905,7 +11905,31 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
||||||
if ((paramIdx == 0) && (functionThisType != NULL))
|
if ((paramIdx == 0) && (functionThisType != NULL))
|
||||||
paramDef->mParamKind = BfParamKind_ExplicitThis;
|
paramDef->mParamKind = BfParamKind_ExplicitThis;
|
||||||
methodDef->mParams.push_back(paramDef);
|
methodDef->mParams.push_back(paramDef);
|
||||||
|
if ((param->mModToken != NULL) && (param->mModToken->mToken == BfToken_Params))
|
||||||
|
{
|
||||||
|
if (paramIdx == (int)paramTypes.size() - 1)
|
||||||
|
paramDef->mParamKind = BfParamKind_Params;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
failed = true;
|
||||||
|
Fail("Params parameter must be the last parameter", param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto dotTypeRef = BfNodeDynCast<BfDotTypeReference>(paramDef->mTypeRef))
|
||||||
|
{
|
||||||
|
if (dotTypeRef->mDotToken->mToken == BfToken_DotDotDot)
|
||||||
|
{
|
||||||
|
if (paramIdx == (int)paramTypes.size() - 1)
|
||||||
|
paramDef->mParamKind = BfParamKind_VarArgs;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
failed = true;
|
||||||
|
Fail("Varargs specifier must be the last parameter", param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delegateInfo->mParams.Add(paramType);
|
delegateInfo->mParams.Add(paramType);
|
||||||
|
|
||||||
delegateType->mGenericDepth = BF_MAX(delegateType->mGenericDepth, paramType->GetGenericDepth() + 1);
|
delegateType->mGenericDepth = BF_MAX(delegateType->mGenericDepth, paramType->GetGenericDepth() + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue