mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Base ctor fixes
This commit is contained in:
parent
e6344c02b1
commit
64cb1ab193
2 changed files with 20 additions and 4 deletions
|
@ -14408,7 +14408,10 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
|||
(baseType->mTypeDef != mCompiler->mBfObjectTypeDef))
|
||||
{
|
||||
// Try to find a ctor without any params first
|
||||
BfMethodDef* matchedMethod = NULL;
|
||||
BfMethodDef* matchedMethod = NULL;
|
||||
bool hadCtorWithAllDefaults = false;
|
||||
|
||||
bool isGenerated = methodDeclaration == NULL;
|
||||
|
||||
for (int pass = 0; pass < 2; pass++)
|
||||
{
|
||||
|
@ -14421,13 +14424,26 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
|||
|
||||
while (checkMethodDef != NULL)
|
||||
{
|
||||
bool allowMethod = checkMethodDef->mProtection > BfProtection_Private;
|
||||
bool allowMethod = checkMethodDef->mProtection > BfProtection_Private;
|
||||
|
||||
if (isGenerated)
|
||||
{
|
||||
// Allow calling of the default base ctor if it is implicitly defined
|
||||
if ((checkMethodDef->mMethodDeclaration == NULL) && (pass == 1) && (!hadCtorWithAllDefaults))
|
||||
allowMethod = true;
|
||||
}
|
||||
|
||||
if ((checkMethodDef->mMethodType == BfMethodType_Ctor) && (!checkMethodDef->mIsStatic) && (allowMethod))
|
||||
{
|
||||
if (checkMethodDef->mParams.size() == 0)
|
||||
{
|
||||
matchedMethod = checkMethodDef;
|
||||
}
|
||||
}
|
||||
else if (isGenerated)
|
||||
{
|
||||
if ((checkMethodDef->mParams[0]->mParamDeclaration != NULL) && (checkMethodDef->mParams[0]->mParamDeclaration->mInitializer != NULL))
|
||||
hadCtorWithAllDefaults = true;
|
||||
}
|
||||
}
|
||||
|
||||
checkMethodDef = checkMethodDef->mNextWithSameName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue