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

Improved param defaults, allowing for implicit cast operators

This commit is contained in:
Brian Fiete 2020-05-07 13:19:02 -07:00
parent ea072ad77b
commit 5bbffe268b
6 changed files with 98 additions and 32 deletions

View file

@ -14797,7 +14797,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
{
auto localVar = mCurMethodState->GetRootMethodState()->mLocals[1];
BF_ASSERT(localVar->mName == "appendIdx");
auto intRefType = CreateRefType(localVar->mResolvedType);
auto intRefType = localVar->mResolvedType;
appendIdxVal = BfTypedValue(localVar->mValue, intRefType);
mCurMethodState->mCurAppendAlign = 1; // Don't make any assumptions about how the base leaves the alignment
}
@ -19599,10 +19599,10 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
{
BF_ASSERT(defaultValue.mValue.IsConst());
while ((int)mCurMethodInstance->mDefaultValues.size() < paramDefIdx)
mCurMethodInstance->mDefaultValues.Add(BfIRValue());
mCurMethodInstance->mDefaultValues.Add(BfTypedValue());
CurrentAddToConstHolder(defaultValue.mValue);
mCurMethodInstance->mDefaultValues.Add(defaultValue.mValue);
mCurMethodInstance->mDefaultValues.Add(defaultValue);
}
}
}