1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed some module mutability issues

This commit is contained in:
Brian Fiete 2020-12-03 06:27:10 -08:00
parent adf46175cf
commit 230b71cecb
2 changed files with 15 additions and 4 deletions

View file

@ -12836,9 +12836,15 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
}
else if ((!declareModule->mIsModuleMutable) && (!mCompiler->mIsResolveOnly))
{
BF_ASSERT(!methodInstance->mIsReified);
if (!methodInstance->mIsReified)
{
declareModule = mContext->mUnreifiedModule;
}
else
{
declareModule->PrepareForIRWriting(methodInstance->GetOwner());
}
}
SetMethodDependency(methodInstance);
@ -21477,7 +21483,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
// we have defined ourselves and which are from the parent module or other extensions
if (!func.IsFake())
{
BF_ASSERT(func);
if (func)
mFuncReferences[methodInstance] = func;
}
}

View file

@ -4984,6 +4984,11 @@ void BfModule::AddMethodToWorkList(BfMethodInstance* methodInstance)
BF_ASSERT(defaultMethod != NULL);
if (methodInstance->mMethodInstanceGroup->mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingReference)
{
if ((defaultMethod->mIsReified) && (!defaultMethod->mDeclModule->mIsModuleMutable))
{
defaultMethod->mDeclModule->PrepareForIRWriting(methodInstance->GetOwner());
}
AddMethodToWorkList(defaultMethod);
}
}