1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed methodRef dependency, fixed var handling for expression bodies

This commit is contained in:
Brian Fiete 2020-07-01 09:54:16 -07:00
parent 9f3d025ab5
commit 6021518343

View file

@ -11276,6 +11276,9 @@ void BfModule::AddMethodReference(const BfMethodRef& methodRef, BfGetMethodInsta
{
BF_ASSERT(!methodRef.mTypeInstance->IsFunction());
// This ensures we rebuild - there are some cases where we get a method reference but never call it, so this is required here
AddDependency(methodInstance->GetOwner(), mCurTypeInstance, BfDependencyMap::DependencyFlag_Calls);
BfMethodRef methodRef = methodInstance;
BfSpecializedMethodRefInfo* specializedMethodRefInfo = NULL;
bool isNew = mCurTypeInstance->mSpecializedMethodReferences.TryAdd(methodRef, NULL, &specializedMethodRefInfo);
@ -18007,7 +18010,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
UpdateSrcPos(expressionBody);
auto retVal = CreateValueFromExpression(expressionBody, expectingType, exprEvalFlags);
if ((retVal) && (expectingType != NULL))
if ((retVal) && (!retVal.mType->IsVar()) && (expectingType != NULL))
{
mCurMethodState->mHadReturn = true;
retVal = LoadValue(retVal);