From f505c9b6aac856acd0a94ff116d3865c6d30cbd4 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 19 May 2020 13:19:26 -0700 Subject: [PATCH] Fixed autoprops in structs --- IDEHelper/Backend/BeIRCodeGen.cpp | 5 +++++ IDEHelper/Compiler/BfModule.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Backend/BeIRCodeGen.cpp b/IDEHelper/Backend/BeIRCodeGen.cpp index edbf581f..f069c327 100644 --- a/IDEHelper/Backend/BeIRCodeGen.cpp +++ b/IDEHelper/Backend/BeIRCodeGen.cpp @@ -2115,6 +2115,11 @@ void BeIRCodeGen::HandleNextCmd() case BfIRCmd_CreateRet: { CMD_PARAM(BeValue*, val); +#ifdef _DEBUG + auto retType = val->GetType(); + auto funcType = mActiveFunction->GetFuncType(); + BF_ASSERT(retType == funcType->mReturnType); +#endif SetResult(curId, mBeModule->CreateRet(val)); } break; diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 69d81f35..bc419ab8 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -17532,7 +17532,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup) else if (mCurTypeInstance->IsObject()) lookupValue = BfTypedValue(mBfIRBuilder->CreateInBoundsGEP(GetThis().mValue, 0, fieldInstance->mDataIdx), fieldInstance->mResolvedType, true); else - lookupValue = ExtractValue(GetThis(), fieldInstance, fieldInstance->mFieldIdx); + lookupValue = ExtractValue(GetThis(), fieldInstance, fieldInstance->mDataIdx); lookupValue = LoadOrAggregateValue(lookupValue); CreateReturn(lookupValue.mValue); EmitLifetimeEnds(&mCurMethodState->mHeadScope);