1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Zero out typed primitives in ctor

This commit is contained in:
Brian Fiete 2021-11-01 11:41:45 -07:00
parent 209f11836e
commit ed99fb9bdf

View file

@ -16578,6 +16578,12 @@ void BfModule::EmitCtorBody(bool& skipBody)
bool calledCtorNoBody = false;
if ((mCurTypeInstance->IsTypedPrimitive()) && (!mCurTypeInstance->IsValuelessType()))
{
// Zero out typed primitives in ctor
mBfIRBuilder->CreateStore(GetDefaultValue(mCurTypeInstance->GetUnderlyingType()), mBfIRBuilder->GetArgument(0));
}
if ((!mCurTypeInstance->IsBoxed()) && (methodDef->mMethodType == BfMethodType_Ctor) && (!hadThisInitializer))
{
// Call the root type's default ctor (with no body) to initialize its fields and call the chained ctors
@ -17039,7 +17045,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
else
autoComplete->mIsCapturingMethodMatchInfo = false;
}
}
}
}
void BfModule::EmitEnumToStringBody()