1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Reworked !hasRequiredTypes state

This commit is contained in:
Brian Fiete 2021-02-07 06:00:34 -08:00
parent 5f5c752f5d
commit eddbf7a984
11 changed files with 104 additions and 77 deletions

View file

@ -416,15 +416,22 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
}
else
{
if ((argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
{
if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
{
mModule->Fail("Expression does not evaluate to a constant value", argExpr);
}
bool requiresConst = false;
if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
requiresConst = true;
if ((requiresConst) && (argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
{
mModule->Fail("Expression does not evaluate to a constant value", argExpr);
}
llvmArgs.push_back(argValue.mValue);
if (!argValue.mType->IsVar())
{
if ((!requiresConst) || (argValue.mValue.IsConst()) || (argValue.mType->IsValuelessType()))
llvmArgs.push_back(argValue.mValue);
else
llvmArgs.push_back(mModule->GetDefaultValue(argValue.mType));
}
paramIdx++;
}
argIdx++;