private MosaMethod FindImplicitInterfaceMethod(MosaType type, MosaMethod interfaceMethod) { MosaMethod methodFound = null; var cleanInterfaceMethodName = GetNonExplicitMethodName(interfaceMethod); foreach (var method in type.Methods) { if (method.HasOpenGenericParams) { continue; } if (IsExplicitInterfaceMethod(method)) { continue; } string cleanMethodName = GetNonExplicitMethodName(method); if (cleanInterfaceMethodName.Equals(cleanMethodName) && interfaceMethod.SameSignature(method)) { return(method); } } if (type.BaseType != null) { methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod); } return(methodFound); }
private MosaMethod FindInterfaceMethod(MosaType type, MosaMethod interfaceMethod) { MosaMethod methodFound = null; if (type.BaseType != null) { methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod); } var cleanInterfaceMethodName = GetNonExplicitMethodName(interfaceMethod); foreach (var method in type.Methods) { if (method.HasOpenGenericParams) { continue; } if (IsExplicitInterfaceMethod(method) && methodFound != null) { continue; } string cleanMethodName = GetNonExplicitMethodName(method); if (cleanInterfaceMethodName.Equals(cleanMethodName)) { if (interfaceMethod.SameSignature(method)) { return(method); } } } if (type.BaseType != null) { methodFound = FindInterfaceMethod(type.BaseType, interfaceMethod); } if (methodFound != null) { return(methodFound); } throw new InvalidOperationException($"Failed to find implicit interface implementation for type {type} and interface method {interfaceMethod}"); }