| 26832 | } |
| 26833 | |
| 26834 | void BfModule::CheckOverridenMethod(BfMethodInstance* methodInstance, BfMethodInstance* methodOverriden) |
| 26835 | { |
| 26836 | auto methodDef = methodInstance->mMethodDef; |
| 26837 | auto prevProtection = methodOverriden->mMethodDef->mProtection; |
| 26838 | if ((methodDef->mProtection != prevProtection) && (methodDef->mMethodType != BfMethodType_Dtor)) |
| 26839 | { |
| 26840 | const char* protectionNames[] = { "disabled", "hidden", "private", "internal", "protected", "protected internal", "public" }; |
| 26841 | BF_STATIC_ASSERT(BF_ARRAY_COUNT(protectionNames) == BfProtection_COUNT); |
| 26842 | BfAstNode* protectionRefNode = NULL; |
| 26843 | if (auto propertyMethodDeclaration = methodDef->GetPropertyMethodDeclaration()) |
| 26844 | { |
| 26845 | protectionRefNode = propertyMethodDeclaration->mProtectionSpecifier; |
| 26846 | if (protectionRefNode == NULL) |
| 26847 | protectionRefNode = propertyMethodDeclaration->mPropertyDeclaration->mProtectionSpecifier; |
| 26848 | if (protectionRefNode == NULL) |
| 26849 | protectionRefNode = propertyMethodDeclaration->mPropertyDeclaration->mNameNode; |
| 26850 | } |
| 26851 | else if (auto methodDeclaration = methodDef->GetMethodDeclaration()) |
| 26852 | { |
| 26853 | protectionRefNode = methodDeclaration->mProtectionSpecifier; |
| 26854 | if (protectionRefNode == NULL) |
| 26855 | protectionRefNode = methodDeclaration->mNameNode; |
| 26856 | } |
| 26857 | if (protectionRefNode != NULL) |
| 26858 | Fail(StrFormat("Cannot change access modifiers when overriding '%s' inherited member", protectionNames[(int)prevProtection]), protectionRefNode, true); |
| 26859 | } |
| 26860 | } |
| 26861 | |
| 26862 | bool BfModule::SlotInterfaceMethod(BfMethodInstance* methodInstance) |
| 26863 | { |
nothing calls this directly
no test coverage detected