示例#1
0
        private MosaMethod FindImplicitInterfaceMethod(MosaType type, MosaMethod interfaceMethod)
        {
            MosaMethod methodFound = null;

            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                if (IsExplicitInterfaceMethod(method.FullName))
                {
                    continue;
                }

                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Equals(method))
                    {
                        return(method);
                    }
                }
            }

            if (type.BaseType != null)
            {
                methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod);
            }

            return(methodFound);
        }
示例#2
0
        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.Equals(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}");
        }
示例#3
0
        private MosaMethod FindInterfaceMethod(MosaType type, MosaMethod interfaceMethod)
        {
            MosaMethod methodFound = null;

            if (type.BaseType != null)
            {
                methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod);
            }

            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                if (IsExplicitInterfaceMethod(method.FullName) && methodFound != null)
                {
                    continue;
                }

                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Equals(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);
        }
示例#4
0
        private MosaMethod FindInterfaceMethod(MosaType type, MosaMethod interfaceMethod)
        {
            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Equals(method))
                    {
                        return method;
                    }
                }
            }

            if (type.BaseType != null)
            {
                return FindInterfaceMethod(type.BaseType, interfaceMethod);
            }

            throw new InvalidOperationException(@"Failed to find implicit interface implementation for type " + type + " and interface method " + interfaceMethod);
        }
示例#5
0
        private MosaMethod FindInterfaceMethod(MosaType type, MosaMethod interfaceMethod)
        {
            MosaMethod methodFound = null;

            if (type.BaseType != null)
            {
                methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod);
            }

            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                if (IsExplicitInterfaceMethod(method.FullName) && methodFound != null)
                    continue;

                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Equals(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);
        }
示例#6
0
        private MosaMethod FindImplicitInterfaceMethod(MosaType type, MosaMethod interfaceMethod)
        {
            MosaMethod methodFound = null;

            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                if (IsExplicitInterfaceMethod(method.FullName))
                    continue;

                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Equals(method))
                    {
                        return method;
                    }
                }
            }

            if (type.BaseType != null)
            {
                methodFound = FindImplicitInterfaceMethod(type.BaseType, interfaceMethod);
            }

            return methodFound;
        }