Răsfoiți Sursa

Fixed issue with nested valueless lambdas

Brian Fiete 4 ani în urmă
părinte
comite
a3211809c6

+ 6 - 0
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;

+ 4 - 0
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;