From a3211809c6f9738a7b53164ea45a003924ae6906 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 20 Oct 2020 05:23:39 -0700 Subject: [PATCH] Fixed issue with nested valueless lambdas --- IDEHelper/Compiler/BfExprEvaluator.cpp | 6 ++++++ IDEHelper/Compiler/BfModuleTypeUtils.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 9e8c3d86..704cfbd4 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -10931,6 +10931,12 @@ BfLambdaInstance* BfExprEvaluator::GetLambdaInstance(BfLambdaBindExpression* lam if (invokeMethodInstance != NULL) { + if (mModule->mBfIRBuilder->mIgnoreWrites) + { + mResult = mModule->GetDefaultTypedValue(mExpectingType, false, BfDefaultValueKind_Addr); + return NULL; + } + BfLocalMethod* localMethod = new BfLocalMethod(); localMethod->mMethodName = "anon"; localMethod->mSystem = mModule->mSystem; diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index b0b79c06..5d99b92b 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -5293,6 +5293,10 @@ BfIRType BfModule::GetIRLoweredType(BfTypeCode loweredTypeCode, BfTypeCode lower BfMethodRefType* BfModule::CreateMethodRefType(BfMethodInstance* methodInstance, bool mustAlreadyExist) { + // Make sure we don't have a partially-formed local method or lambda coming in, because those may be replaced + // after the capture phase + BF_ASSERT(!methodInstance->mDisallowCalling); + auto methodRefType = new BfMethodRefType(); methodRefType->mContext = mContext; //methodRefType->mCaptureType = NULL;