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

ceEmitContext null check

This commit is contained in:
Brian Fiete 2023-11-28 06:39:40 -05:00
parent 023b20dfee
commit fa256701c7

View file

@ -2792,9 +2792,18 @@ void BfModule::ExecuteCEOnCompile(CeEmitContext* ceEmitContext, BfTypeInstance*
if (useTypeInstance->IsUnspecializedTypeVariation())
useTypeInstance = GetUnspecializedTypeInstance(useTypeInstance);
SetAndRestoreValue<BfType*> prevTypeInstance(ceEmitContext->mType, useTypeInstance);
BfType* prevContextTypeInstance = NULL;
if (ceEmitContext != NULL)
{
prevContextTypeInstance = ceEmitContext->mType;
ceEmitContext->mType = useTypeInstance;
}
methodInstance = GetRawMethodInstanceAtIdx(useTypeInstance, methodDef->mIdx);
result = mCompiler->mCeMachine->Call(methodDef->GetRefNode(), this, methodInstance, {}, (CeEvalFlags)(CeEvalFlags_PersistantError | CeEvalFlags_DeferIfNotOnlyError), NULL);
if (ceEmitContext != NULL)
ceEmitContext->mType = prevContextTypeInstance;
}
if ((onCompileKind == BfCEOnCompileKind_TypeDone) && (typeInstance->mDefineState > BfTypeDefineState_CETypeInit))