1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed local methods in methods with out parameters

This commit is contained in:
Brian Fiete 2020-09-07 06:45:56 -07:00
parent 03c28503c6
commit f868d56abb

View file

@ -2077,7 +2077,7 @@ void BfModule::LocalVariableDone(BfLocalVariable* localVar, bool isMethodExit)
//bool deferFullAnalysis = true;
bool deferUsageWarning = deferFullAnalysis && mCompiler->IsAutocomplete();
if (!localVar->mIsAssigned)
if ((!localVar->mIsAssigned) && (!localVar->mIsImplicitParam))
{
if (deferUsageWarning)
{
@ -19250,7 +19250,7 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
SetAndRestoreValue<bool> ignoreError(mIgnoreErrors, true);
*/
SetAndRestoreValue<BfMethodInstance*> prevMethodInstance(mCurMethodInstance, methodInstance);
//SetAndRestoreValue<bool> wantsIgnoreWrites(mWantsISIgnoreWrites, true);
mBfIRBuilder->SaveDebugLocation();
closureState.mCaptureVisitingBody = true;
@ -19271,11 +19271,16 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
localDef->mAddr = CreateAlloca(localDef->mResolvedType);
}
}
// Keep outs for being marked as assigned
auto rootMethodState = mCurMethodState->GetRootMethodState();
BfDeferredLocalAssignData deferredLocalAssignData(rootMethodState->mCurScope);
deferredLocalAssignData.mVarIdBarrier = rootMethodState->mCurLocalVarId;
SetAndRestoreValue<BfDeferredLocalAssignData*> prevDLA(rootMethodState->mDeferredLocalAssignData, &deferredLocalAssignData);
_VisitLambdaBody();
RestoreScopeState();
//ProcessMethod(methodInstance);
closureState.mCaptureVisitingBody = false;
mBfIRBuilder->RestoreDebugLocation();
}
@ -19288,8 +19293,6 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
prevClosureState->mCaptureStartAccessId = closureState.mCaptureStartAccessId;
}
//RestoreScopeState();
// Actually get the referenced local methods. It's important we wait until after visiting the body, because then our own capture information
// can be used by these methods (which will be necessary if any of these methods call us directly or indirectly)
closureState.mClosureMethodDef = NULL;