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

Generic constructors

This commit is contained in:
Brian Fiete 2024-11-06 07:31:55 -05:00
parent 64d646e130
commit 04ea8a6634
13 changed files with 267 additions and 37 deletions

View file

@ -604,7 +604,8 @@ BfMethodDef* BfDefBuilder::CreateMethodDef(BfMethodDeclaration* methodDeclaratio
if ((methodDef->mMethodType == BfMethodType_Normal) ||
(methodDef->mMethodType == BfMethodType_Operator) ||
(methodDef->mMethodType == BfMethodType_Mixin) ||
(methodDef->mMethodType == BfMethodType_Extension))
(methodDef->mMethodType == BfMethodType_Extension) ||
(methodDef->mMethodType == BfMethodType_Ctor))
{
bool isGeneric = (methodDeclaration->mGenericParams != NULL) || (!mCurTypeDef->mGenericParamDefs.IsEmpty());
ParseGenericParams(methodDeclaration->mGenericParams, methodDeclaration->mGenericConstraintsDeclaration, methodDef->mGenericParams, &methodDef->mExternalConstraints, outerGenericSize, isGeneric);
@ -2085,6 +2086,14 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
methodDef->mParams.push_back(newParam);
}
for (auto genericParam : method->mGenericParams)
{
BfGenericParamDef* newGenericParam = new BfGenericParamDef();
*newGenericParam = *genericParam;
methodDef->mGenericParams.Add(newGenericParam);
}
methodDef->mExternalConstraints = method->mExternalConstraints;
// Insert a 'appendIdx'
BfParameterDef* newParam = new BfParameterDef();
newParam->mName = "appendIdx";