mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Added ReflectAttribute.ReflectImplementer
This commit is contained in:
parent
52ccdfe46a
commit
0e10eba8f5
3 changed files with 37 additions and 3 deletions
|
@ -13565,7 +13565,7 @@ BfReflectKind BfModule::GetUserReflectKind(BfTypeInstance* attrType)
|
|||
}
|
||||
|
||||
BfReflectKind BfModule::GetReflectKind(BfReflectKind reflectKind, BfTypeInstance* typeInstance)
|
||||
{
|
||||
{
|
||||
auto checkTypeInstance = typeInstance;
|
||||
while (checkTypeInstance != NULL)
|
||||
{
|
||||
|
@ -13601,6 +13601,30 @@ BfReflectKind BfModule::GetReflectKind(BfReflectKind reflectKind, BfTypeInstance
|
|||
}
|
||||
}
|
||||
|
||||
for (auto ifaceEntry : typeInstance->mInterfaces)
|
||||
{
|
||||
if (ifaceEntry.mInterfaceType->mCustomAttributes != NULL)
|
||||
{
|
||||
auto iface = ifaceEntry.mInterfaceType;
|
||||
auto customAttr = iface->mCustomAttributes->Get(mCompiler->mReflectAttributeTypeDef);
|
||||
if (customAttr != NULL)
|
||||
{
|
||||
for (auto& prop : customAttr->mSetProperties)
|
||||
{
|
||||
auto propDef = prop.mPropertyRef.mTypeInstance->mTypeDef->mProperties[prop.mPropertyRef.mPropIdx];
|
||||
if (propDef->mName == "ReflectImplementer")
|
||||
{
|
||||
if (prop.mParam.mValue.IsConst())
|
||||
{
|
||||
auto constant = iface->mConstHolder->GetConstant(prop.mParam.mValue);
|
||||
reflectKind = (BfReflectKind)(reflectKind | (BfReflectKind)constant->mInt32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkTypeInstance = mContext->mUnreifiedModule->GetOuterType(checkTypeInstance);
|
||||
}
|
||||
|
||||
|
|
|
@ -1741,8 +1741,10 @@ int BfModule::GenerateTypeOptions(BfCustomAttributes* customAttributes, BfTypeIn
|
|||
{
|
||||
StringT<128> ifaceName = TypeToString(iface.mInterfaceType);
|
||||
if (BfCheckWildcard(checkFilter, ifaceName))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkTypeInst = checkTypeInst->mBaseType;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue