mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixes for global ctor/dtor/mark
This commit is contained in:
parent
8c6de21bf8
commit
2fdf87c7a2
2 changed files with 43 additions and 34 deletions
|
@ -916,9 +916,11 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
|||
if (methodDef->mHasComptime)
|
||||
name += "`COMPTIME";
|
||||
|
||||
if ((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (methodInst->mMethodDef->mDeclaringType->IsExtension()) &&
|
||||
if (((methodInst->GetOwner()->mTypeDef->IsGlobalsContainer()) &&
|
||||
((methodDef->mMethodType == BfMethodType_Ctor) || (methodDef->mMethodType == BfMethodType_Dtor) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))) ||
|
||||
((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (methodInst->mMethodDef->mDeclaringType->IsExtension()) &&
|
||||
(!methodInst->mIsForeignMethodDef) && (!methodInst->mMethodDef->mIsExtern) &&
|
||||
((!methodInst->mMethodDef->mIsOverride) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mMethodType == BfMethodType_Dtor)))
|
||||
((!methodInst->mMethodDef->mIsOverride) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mMethodType == BfMethodType_Dtor))))
|
||||
{
|
||||
auto declType = methodInst->mMethodDef->mDeclaringType;
|
||||
BF_ASSERT(methodInst->GetOwner()->mTypeDef->mIsCombinedPartial);
|
||||
|
@ -2074,9 +2076,11 @@ void BfMSMangler::Mangle(StringImpl& name, bool is64Bit, BfMethodInstance* metho
|
|||
AddStr(mangleContext, name, methodDef->mName);
|
||||
}
|
||||
|
||||
if ((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (methodInst->mMethodDef->mDeclaringType->IsExtension()) &&
|
||||
if (((methodInst->GetOwner()->mTypeDef->IsGlobalsContainer()) &&
|
||||
((methodDef->mMethodType == BfMethodType_Ctor) || (methodDef->mMethodType == BfMethodType_Dtor) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))) ||
|
||||
((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (methodInst->mMethodDef->mDeclaringType->IsExtension()) &&
|
||||
(!methodInst->mIsForeignMethodDef) && (!methodInst->mMethodDef->mIsExtern) &&
|
||||
((!methodInst->mMethodDef->mIsOverride) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mMethodType == BfMethodType_Dtor)))
|
||||
((!methodInst->mMethodDef->mIsOverride) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS) || (methodDef->mMethodType == BfMethodType_Dtor))))
|
||||
{
|
||||
auto declType = methodInst->mMethodDef->mDeclaringType;
|
||||
BF_ASSERT(methodInst->GetOwner()->mTypeDef->mIsCombinedPartial);
|
||||
|
|
|
@ -3151,6 +3151,8 @@ void BfSystem::FinishCompositePartial(BfTypeDef* compositeTypeDef)
|
|||
for (auto partialTypeDef : nextRevision->mPartials)
|
||||
{
|
||||
bool isExtension = partialTypeDef->mTypeDeclaration != nextRevision->mTypeDeclaration;
|
||||
if (!isExtension)
|
||||
primaryDef = partialTypeDef;
|
||||
|
||||
bool hasInitializers = false;
|
||||
for (auto methodDef : partialTypeDef->mMethods)
|
||||
|
@ -3218,6 +3220,8 @@ void BfSystem::FinishCompositePartial(BfTypeDef* compositeTypeDef)
|
|||
// methodDef->mIsMutating = true;
|
||||
// }
|
||||
|
||||
if (!primaryDef->IsGlobalsContainer())
|
||||
{
|
||||
// Static ctor
|
||||
if ((allHasMethods[0][1].mCtor == 0) && (allHasMethods[1][1].mCtor > 1))
|
||||
{
|
||||
|
@ -3250,6 +3254,7 @@ void BfSystem::FinishCompositePartial(BfTypeDef* compositeTypeDef)
|
|||
auto methodDef = BfDefBuilder::AddMethod(nextRevision, BfMethodType_Normal, BfProtection_Public, true, BF_METHODNAME_MARKMEMBERS_STATIC);
|
||||
methodDef->mDeclaringType = primaryDef;
|
||||
}
|
||||
}
|
||||
|
||||
// If this fails, it's probably because there were no actual composite pieces to put into it
|
||||
BF_ASSERT(nextRevision != NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue