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

Initializer expressions

This commit is contained in:
Brian Fiete 2020-06-18 06:12:14 -07:00
parent f6e31e4976
commit 229a5aa5c5
17 changed files with 305 additions and 18 deletions

View file

@ -1920,9 +1920,13 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
if ((needsDefaultCtor) && (!hasDefaultCtor))
{
BfProtection prot = hasCtor ? BfProtection_Hidden : BfProtection_Public;
if (mCurTypeDef->mName == mSystem->mEmptyAtom)
prot = BfProtection_Hidden;
// Create default constructor. If it's the only constructor then make it public,
// otherwise make it private so we can still internally use it but the user can't
auto methodDef = AddMethod(mCurTypeDef, BfMethodType_Ctor, hasCtor ? BfProtection_Hidden : BfProtection_Public, false, "");
auto methodDef = AddMethod(mCurTypeDef, BfMethodType_Ctor, prot, false, "");
methodDef->mIsMutating = true;
}