mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Properly add dependencies on operator constraint types
This commit is contained in:
parent
476df62a24
commit
3a8e4ebc9d
3 changed files with 22 additions and 25 deletions
|
@ -3581,6 +3581,23 @@ void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BfModule::AddDependency(BfGenericParamInstance* genericParam, BfTypeInstance* usingType)
|
||||||
|
{
|
||||||
|
if (!genericParam->mExternType->IsGenericParam())
|
||||||
|
AddDependency(genericParam->mExternType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
||||||
|
for (auto constraintTypeInst : genericParam->mInterfaceConstraints)
|
||||||
|
AddDependency(constraintTypeInst, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
||||||
|
for (auto& operatorConstraint : genericParam->mOperatorConstraints)
|
||||||
|
{
|
||||||
|
if (operatorConstraint.mLeftType != NULL)
|
||||||
|
AddDependency(operatorConstraint.mLeftType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
||||||
|
if (operatorConstraint.mRightType != NULL)
|
||||||
|
AddDependency(operatorConstraint.mRightType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
||||||
|
}
|
||||||
|
if (genericParam->mTypeConstraint != NULL)
|
||||||
|
AddDependency(genericParam->mTypeConstraint, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
||||||
|
}
|
||||||
|
|
||||||
void BfModule::AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized)
|
void BfModule::AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized)
|
||||||
{
|
{
|
||||||
if ((mCurMethodState != NULL) && (mCurMethodState->mHotDataReferenceBuilder != NULL))
|
if ((mCurMethodState != NULL) && (mCurMethodState->mHotDataReferenceBuilder != NULL))
|
||||||
|
@ -22152,14 +22169,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
auto constraintType = ResolveTypeRef(typeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_None);
|
auto constraintType = ResolveTypeRef(typeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_None);
|
||||||
|
|
||||||
for (auto genericParam : methodInstance->mMethodInfoEx->mGenericParams)
|
for (auto genericParam : methodInstance->mMethodInfoEx->mGenericParams)
|
||||||
{
|
AddDependency(genericParam, mCurTypeInstance);
|
||||||
if (!genericParam->mExternType->IsGenericParam())
|
|
||||||
AddDependency(genericParam->mExternType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
for (auto constraintTypeInst : genericParam->mInterfaceConstraints)
|
|
||||||
AddDependency(constraintTypeInst, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
if (genericParam->mTypeConstraint != NULL)
|
|
||||||
AddDependency(genericParam->mTypeConstraint, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((methodInstance->mIsAutocompleteMethod) && (methodDeclaration != NULL) && (!methodInstance->IsSpecializedGenericMethod()) && (methodDef->mIdx >= 0))
|
if ((methodInstance->mIsAutocompleteMethod) && (methodDeclaration != NULL) && (!methodInstance->IsSpecializedGenericMethod()) && (methodDef->mIdx >= 0))
|
||||||
|
|
|
@ -1730,6 +1730,7 @@ public:
|
||||||
bool CheckDefineMemberProtection(BfProtection protection, BfType* memberType);
|
bool CheckDefineMemberProtection(BfProtection protection, BfType* memberType);
|
||||||
void CheckMemberNames(BfTypeInstance* typeInst);
|
void CheckMemberNames(BfTypeInstance* typeInst);
|
||||||
void AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags);
|
void AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags);
|
||||||
|
void AddDependency(BfGenericParamInstance* genericParam, BfTypeInstance* usingType);
|
||||||
void AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized = false);
|
void AddCallDependency(BfMethodInstance* methodInstance, bool devirtualized = false);
|
||||||
void AddFieldDependency(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfType* fieldType);
|
void AddFieldDependency(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfType* fieldType);
|
||||||
void TypeFailed(BfTypeInstance* typeInstance);
|
void TypeFailed(BfTypeInstance* typeInstance);
|
||||||
|
|
|
@ -108,14 +108,7 @@ BfGenericExtensionEntry* BfModule::BuildGenericExtensionInfo(BfTypeInstance* gen
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto genericParam : genericExEntry->mGenericParams)
|
for (auto genericParam : genericExEntry->mGenericParams)
|
||||||
{
|
AddDependency(genericParam, mCurTypeInstance);
|
||||||
if (!genericParam->mExternType->IsGenericParam())
|
|
||||||
AddDependency(genericParam->mExternType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
for (auto constraintTypeInst : genericParam->mInterfaceConstraints)
|
|
||||||
AddDependency(constraintTypeInst, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
if (genericParam->mTypeConstraint != NULL)
|
|
||||||
AddDependency(genericParam->mTypeConstraint, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
}
|
|
||||||
|
|
||||||
return genericExEntry;
|
return genericExEntry;
|
||||||
}
|
}
|
||||||
|
@ -301,15 +294,8 @@ bool BfModule::FinishGenericParams(BfType* resolvedTypeRef)
|
||||||
for (auto typeRef : deferredResolveTypes)
|
for (auto typeRef : deferredResolveTypes)
|
||||||
auto constraintType = ResolveTypeRef(typeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_None);
|
auto constraintType = ResolveTypeRef(typeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_None);
|
||||||
|
|
||||||
for (auto genericParam : genericTypeInst->mGenericTypeInfo->mGenericParams)
|
for (auto genericParam : genericTypeInst->mGenericTypeInfo->mGenericParams)
|
||||||
{
|
AddDependency(genericParam, mCurTypeInstance);
|
||||||
if (!genericParam->mExternType->IsGenericParam())
|
|
||||||
AddDependency(genericParam->mExternType, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
for (auto constraintTypeInst : genericParam->mInterfaceConstraints)
|
|
||||||
AddDependency(constraintTypeInst, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
if (genericParam->mTypeConstraint != NULL)
|
|
||||||
AddDependency(genericParam->mTypeConstraint, mCurTypeInstance, BfDependencyMap::DependencyFlag_Constraint);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue