1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Added type initializer blocks

This commit is contained in:
Brian Fiete 2020-10-23 07:48:41 -07:00
parent 9a857cceb3
commit 879b15ecd8
6 changed files with 154 additions and 71 deletions

View file

@ -479,11 +479,19 @@ BfMethodDef* BfDefBuilder::CreateMethodDef(BfMethodDeclaration* methodDeclaratio
if (auto ctorDeclaration = BfNodeDynCast<BfConstructorDeclaration>(methodDeclaration))
{
methodDef->mIsMutating = true;
methodDef->mMethodType = BfMethodType_Ctor;
if (methodDef->mIsStatic)
methodDef->mName = "__BfStaticCtor";
if (methodDeclaration->mOpenParen != NULL)
{
methodDef->mMethodType = BfMethodType_Ctor;
if (methodDef->mIsStatic)
methodDef->mName = "__BfStaticCtor";
else
methodDef->mName = "__BfCtor";
}
else
methodDef->mName = "__BfCtor";
{
methodDef->mMethodType = BfMethodType_Init;
methodDef->mName = "__BfInit";
}
}
else if (methodDeclaration->IsA<BfDestructorDeclaration>())
{
@ -1133,6 +1141,10 @@ BfMethodDef* BfDefBuilder::AddMethod(BfTypeDef* typeDef, BfMethodType methodType
methodDef->mName = "__BfCtorClear";
methodDef->mIsNoReflect = true;
}
else if (methodType == BfMethodType_Init)
{
methodDef->mName = "__BfInit";
}
else if (methodType == BfMethodType_Dtor)
{
if (isStatic)