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

consteval reification fixes

This commit is contained in:
Brian Fiete 2020-12-23 14:04:35 -08:00
parent 08e3f9155e
commit 21798e20f9
3 changed files with 27 additions and 7 deletions

View file

@ -12388,6 +12388,13 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
auto defFlags = (BfGetMethodInstanceFlags)(flags & ~BfGetMethodInstanceFlag_ForceInline);
if (mIsConstModule)
{
defFlags = (BfGetMethodInstanceFlags)(flags | BfGetMethodInstanceFlag_NoReference);
if (!mCompiler->mIsResolveOnly)
defFlags = (BfGetMethodInstanceFlags)(flags | BfGetMethodInstanceFlag_NoForceReification | BfGetMethodInstanceFlag_Unreified | BfGetMethodInstanceFlag_NoReference);
}
// Not extern
// Create the instance in the proper module and then create a reference in this one
moduleMethodInst = instModule->GetMethodInstance(typeInst, methodDef, methodGenericArguments, defFlags, foreignType);
@ -12588,6 +12595,9 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
{
methodInstance = methodInstGroup->mDefault;
if ((methodInstance != NULL) && ((flags & BfGetMethodInstanceFlag_NoReference) != 0))
return methodInstance;
if ((methodInstance != NULL) && (isReified) && (!methodInstance->mIsReified))
{
MarkDerivedDirty(typeInst);
@ -12696,6 +12706,9 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
{
methodInstance = *methodInstancePtr;
if ((flags & BfGetMethodInstanceFlag_NoReference) != 0)
return methodInstance;
if ((methodInstance->mRequestedByAutocomplete) && (!mCompiler->IsAutocomplete()))
{
// We didn't want to process this message yet if it was autocomplete-specific, but now we will
@ -13024,6 +13037,9 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
addToWorkList = false;
}
// if ((flags & BfGetMethodInstanceFlag_NoReference) != 0)
// addToWorkList = false;
declareModule->DoMethodDeclaration(methodDef->GetMethodDeclaration(), false, addToWorkList);
if (processNow)

View file

@ -73,7 +73,8 @@ enum BfGetMethodInstanceFlags : uint16
BfGetMethodInstanceFlag_Friend = 0x100,
BfGetMethodInstanceFlag_DisableObjectAccessChecks = 0x200,
BfGetMethodInstanceFlag_NoInline = 0x400,
BfGetMethodInstanceFlag_DepthExceeded = 0x800
BfGetMethodInstanceFlag_DepthExceeded = 0x800,
BfGetMethodInstanceFlag_NoReference = 0x1000
};
class BfDependencyMap

View file

@ -5443,6 +5443,9 @@ BfTypedValue CeMachine::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
SetAndRestoreValue<BfMethodInstance*> prevMethodInstance(mCurMethodInstance, methodInstance);
SetAndRestoreValue<BfType*> prevExpectingType(mCurExpectingType, expectingType);
// Reentrancy may occur as methods need defining
SetAndRestoreValue<BfMethodState*> prevMethodStateInConstEval(module->mCurMethodState, NULL);
if (mAppendAllocInfo != NULL)
{
if ((mAppendAllocInfo->mAppendSizeValue) && (!mAppendAllocInfo->mAppendSizeValue.IsConst()))