1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +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

@ -5272,14 +5272,23 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
if (mModule->mParentNodeEntry != NULL)
{
bool showCtorError = false;
if (auto ctorDeclaration = BfNodeDynCast<BfConstructorDeclaration>(mModule->mParentNodeEntry->mNode))
{
if (ctorDeclaration->mInitializer == NULL)
{
error = mModule->Fail(StrFormat("No parameterless constructor is available for base class. Consider calling base constructor '%s'.",
mModule->MethodToString(methodInstance).c_str()), refNode);
}
showCtorError = true;
}
if (auto typerDecl = BfNodeDynCast<BfTypeDeclaration>(mModule->mParentNodeEntry->mNode))
showCtorError = true;
if (showCtorError)
{
error = mModule->Fail(StrFormat("No parameterless constructor is available for base class. Consider calling base constructor '%s'.",
mModule->MethodToString(methodInstance).c_str()), refNode);
}
}
if (error == NULL)