diff --git a/IDEHelper/Compiler/BfContext.cpp b/IDEHelper/Compiler/BfContext.cpp index 35bcad81..e26403c3 100644 --- a/IDEHelper/Compiler/BfContext.cpp +++ b/IDEHelper/Compiler/BfContext.cpp @@ -1009,6 +1009,9 @@ void BfContext::RebuildType(BfType* type, bool deleteOnDemandTypes, bool rebuild return; } + if (mCompiler->mCeMachine != NULL) + mCompiler->mCeMachine->ClearTypeData(typeInst); + BF_ASSERT_REL(typeInst->mDefineState != BfTypeDefineState_DefinedAndMethodsSlotting); // We need to verify lookups before we rebuild the type, because a type lookup change needs to count as a TypeDataChanged diff --git a/IDEHelper/Compiler/CeMachine.cpp b/IDEHelper/Compiler/CeMachine.cpp index 964272bf..68ac3b7b 100644 --- a/IDEHelper/Compiler/CeMachine.cpp +++ b/IDEHelper/Compiler/CeMachine.cpp @@ -9759,6 +9759,23 @@ void CeMachine::QueueStaticField(BfFieldInstance* fieldInstance, const StringImp mCurBuilder->mStaticFieldInstanceMap[mangledFieldName] = fieldInstance; } +void CeMachine::ClearTypeData(BfTypeInstance* typeInstance) +{ + if (mTypeInfoMap.Remove(typeInstance)) + { + for (auto& methodGroup : typeInstance->mMethodInstanceGroups) + { + if (methodGroup.mDefault != NULL) + mMethodInstanceSet.Remove(methodGroup.mDefault); + if (methodGroup.mMethodSpecializationMap != NULL) + { + for (auto& kv : *methodGroup.mMethodSpecializationMap) + mMethodInstanceSet.Remove(kv.mValue); + } + } + } +} + void CeMachine::SetAppendAllocInfo(BfModule* module, BfIRValue allocValue, BfIRValue appendSizeValue) { delete mAppendAllocInfo; diff --git a/IDEHelper/Compiler/CeMachine.h b/IDEHelper/Compiler/CeMachine.h index d8d8baca..1277b8ff 100644 --- a/IDEHelper/Compiler/CeMachine.h +++ b/IDEHelper/Compiler/CeMachine.h @@ -1257,6 +1257,7 @@ public: CeFunction* QueueMethod(BfMethodInstance* methodInstance, BfIRValue func); void QueueMethod(BfModuleMethodInstance moduleMethodInstance); void QueueStaticField(BfFieldInstance* fieldInstance, const StringImpl& mangledFieldName); + void ClearTypeData(BfTypeInstance* typeInstance); void SetAppendAllocInfo(BfModule* module, BfIRValue allocValue, BfIRValue appendSizeValue); void ClearAppendAllocInfo();