1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Properly complains about hidden parameterless base ctor calling

This commit is contained in:
Brian Fiete 2020-02-13 12:29:06 -08:00
parent 2b0f7fb485
commit 7c44884cf0
2 changed files with 21 additions and 8 deletions

View file

@ -14446,7 +14446,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
BfMethodDef* matchedMethod = NULL;
bool hadCtorWithAllDefaults = false;
bool isGenerated = methodDeclaration == NULL;
bool isHiddenGenerated = (methodDeclaration == NULL) && (methodDef->mProtection == BfProtection_Hidden);
for (int pass = 0; pass < 2; pass++)
{
@ -14461,7 +14461,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
{
bool allowMethod = checkMethodDef->mProtection > BfProtection_Private;
if (isGenerated)
if (isHiddenGenerated)
{
// Allow calling of the default base ctor if it is implicitly defined
if ((checkMethodDef->mMethodDeclaration == NULL) && (pass == 1) && (!hadCtorWithAllDefaults))
@ -14474,7 +14474,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
{
matchedMethod = checkMethodDef;
}
else if (isGenerated)
else if (isHiddenGenerated)
{
if ((checkMethodDef->mParams[0]->mParamDeclaration != NULL) && (checkMethodDef->mParams[0]->mParamDeclaration->mInitializer != NULL))
hadCtorWithAllDefaults = true;
@ -14522,7 +14522,11 @@ void BfModule::EmitCtorBody(bool& skipBody)
if (targetType != NULL)
{
BfAutoParentNodeEntry autoParentNodeEntry(this, methodDeclaration);
BfAstNode* refNode = methodDeclaration;
if (refNode == NULL)
refNode = typeDef->mTypeDeclaration;
BfAutoParentNodeEntry autoParentNodeEntry(this, refNode);
auto autoComplete = mCompiler->GetAutoComplete();
auto wasCapturingMethodInfo = (autoComplete != NULL) && (autoComplete->mIsCapturingMethodMatchInfo);