mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added ReflectAttribute.ReflectImplementer
This commit is contained in:
parent
52ccdfe46a
commit
0e10eba8f5
3 changed files with 37 additions and 3 deletions
|
@ -30,6 +30,9 @@ namespace System
|
|||
Alias = 0x100000,
|
||||
Block = 0x200000,
|
||||
|
||||
Types = .Struct | .Enum | .Function | .Class | .Interface,
|
||||
ValueTypes = .Struct | .Enum | .Function,
|
||||
|
||||
All = Assembly | Module | Class | Struct | Enum | Constructor |
|
||||
Method | Property | Field | StaticField | Interface | Parameter |
|
||||
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess |
|
||||
|
@ -51,7 +54,7 @@ namespace System
|
|||
AllMembers = 0x7F,
|
||||
All = 0xFF, // Doesn't include dynamic boxing
|
||||
|
||||
ApplyToInnerTypes = 0x200,
|
||||
ApplyToInnerTypes = 0x200
|
||||
}
|
||||
|
||||
public enum AttributeFlags
|
||||
|
@ -107,6 +110,11 @@ namespace System
|
|||
public this(ReflectKind reflectKind = .AllMembers)
|
||||
{
|
||||
}
|
||||
|
||||
public ReflectKind ReflectImplementer
|
||||
{
|
||||
set mut { }
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(.Method | .Constructor | .Invocation)]
|
||||
|
|
|
@ -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,9 +1741,11 @@ int BfModule::GenerateTypeOptions(BfCustomAttributes* customAttributes, BfTypeIn
|
|||
{
|
||||
StringT<128> ifaceName = TypeToString(iface.mInterfaceType);
|
||||
if (BfCheckWildcard(checkFilter, ifaceName))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkTypeInst = checkTypeInst->mBaseType;
|
||||
}
|
||||
if (matched)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue