mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00
Fixed static initializer
This commit is contained in:
parent
9d1a5d9f3d
commit
1893988195
2 changed files with 12 additions and 1 deletions
|
@ -1992,6 +1992,11 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (method->mMethodType == BfMethodType_Init)
|
||||||
|
{
|
||||||
|
if (method->mIsStatic)
|
||||||
|
needsStaticInit = true;
|
||||||
|
}
|
||||||
else if (method->mMethodType == BfMethodType_Dtor)
|
else if (method->mMethodType == BfMethodType_Dtor)
|
||||||
{
|
{
|
||||||
if (method->mIsStatic)
|
if (method->mIsStatic)
|
||||||
|
|
|
@ -2949,7 +2949,7 @@ void BfSystem::FinishCompositePartial(BfTypeDef* compositeTypeDef)
|
||||||
bool hasInitializers = false;
|
bool hasInitializers = false;
|
||||||
for (auto methodDef : partialTypeDef->mMethods)
|
for (auto methodDef : partialTypeDef->mMethods)
|
||||||
{
|
{
|
||||||
if (methodDef->mMethodType == BfMethodType_Init)
|
if ((methodDef->mMethodType == BfMethodType_Init) && (!methodDef->mIsStatic))
|
||||||
hasInitializers = true;
|
hasInitializers = true;
|
||||||
auto& hasMethods = allHasMethods[isExtension ? 1 : 0][methodDef->mIsStatic ? 1 : 0];
|
auto& hasMethods = allHasMethods[isExtension ? 1 : 0][methodDef->mIsStatic ? 1 : 0];
|
||||||
if (methodDef->mMethodType == BfMethodType_Ctor)
|
if (methodDef->mMethodType == BfMethodType_Ctor)
|
||||||
|
@ -3012,6 +3012,12 @@ void BfSystem::FinishCompositePartial(BfTypeDef* compositeTypeDef)
|
||||||
// methodDef->mIsMutating = true;
|
// methodDef->mIsMutating = true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (compositeTypeDef->mName->ToString() == "Core")
|
||||||
|
{
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static ctor
|
||||||
if ((allHasMethods[0][1].mCtor == 0) && (allHasMethods[1][1].mCtor > 1))
|
if ((allHasMethods[0][1].mCtor == 0) && (allHasMethods[1][1].mCtor > 1))
|
||||||
{
|
{
|
||||||
auto methodDef = BfDefBuilder::AddMethod(nextRevision, BfMethodType_Ctor, BfProtection_Public, true, "");
|
auto methodDef = BfDefBuilder::AddMethod(nextRevision, BfMethodType_Ctor, BfProtection_Public, true, "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue