| 16685 | } |
| 16686 | |
| 16687 | BfReflectKind BfModule::GetReflectKind(BfReflectKind reflectKind, BfTypeInstance* typeInstance) |
| 16688 | { |
| 16689 | auto checkTypeInstance = typeInstance; |
| 16690 | while (checkTypeInstance != NULL) |
| 16691 | { |
| 16692 | if (checkTypeInstance->mCustomAttributes != NULL) |
| 16693 | { |
| 16694 | auto checkReflectKind = BfReflectKind_None; |
| 16695 | |
| 16696 | for (auto& customAttr : checkTypeInstance->mCustomAttributes->mAttributes) |
| 16697 | { |
| 16698 | if (customAttr.mType->mTypeDef->mName->ToString() == "ReflectAttribute") |
| 16699 | { |
| 16700 | if (customAttr.mCtorArgs.size() > 0) |
| 16701 | { |
| 16702 | auto constant = checkTypeInstance->mConstHolder->GetConstant(customAttr.mCtorArgs[0]); |
| 16703 | checkReflectKind = (BfReflectKind)((int)checkReflectKind | constant->mInt32); |
| 16704 | } |
| 16705 | else |
| 16706 | { |
| 16707 | checkReflectKind = BfReflectKind_All; |
| 16708 | } |
| 16709 | } |
| 16710 | else |
| 16711 | { |
| 16712 | auto userReflectKind = GetUserReflectKind(customAttr.mType); |
| 16713 | checkReflectKind = (BfReflectKind)(checkReflectKind | userReflectKind); |
| 16714 | } |
| 16715 | } |
| 16716 | |
| 16717 | if ((checkTypeInstance == typeInstance) || |
| 16718 | ((checkReflectKind & BfReflectKind_ApplyToInnerTypes) != 0)) |
| 16719 | { |
| 16720 | reflectKind = (BfReflectKind)(reflectKind | checkReflectKind); |
| 16721 | } |
| 16722 | } |
| 16723 | |
| 16724 | for (auto ifaceEntry : typeInstance->mInterfaces) |
| 16725 | { |
| 16726 | if (ifaceEntry.mInterfaceType->mCustomAttributes != NULL) |
| 16727 | { |
| 16728 | auto iface = ifaceEntry.mInterfaceType; |
| 16729 | auto customAttr = iface->mCustomAttributes->Get(mCompiler->mReflectAttributeTypeDef); |
| 16730 | if (customAttr != NULL) |
| 16731 | { |
| 16732 | for (auto& prop : customAttr->mSetProperties) |
| 16733 | { |
| 16734 | auto propDef = prop.mPropertyRef.mTypeInstance->mTypeDef->mProperties[prop.mPropertyRef.mPropIdx]; |
| 16735 | if (propDef->mName == "ReflectImplementer") |
| 16736 | { |
| 16737 | if (prop.mParam.mValue.IsConst()) |
| 16738 | { |
| 16739 | auto constant = iface->mConstHolder->GetConstant(prop.mParam.mValue); |
| 16740 | reflectKind = (BfReflectKind)(reflectKind | (BfReflectKind)constant->mInt32); |
| 16741 | } |
| 16742 | } |
| 16743 | } |
| 16744 | } |
no test coverage detected