예제 #1
0
        /// <summary>
        /// Resolves the type signature with the specified generic arguments.
        /// </summary>
        /// <param name="typeSig">The type signature.</param>
        /// <param name="typeGenArgs">The type generic arguments.</param>
        /// <param name="methodGenArgs">The method generic arguments.</param>
        /// <returns>Resolved type signature.</returns>
        /// <exception cref="System.ArgumentException">No generic arguments to resolve.</exception>
        public static TypeSig Resolve(TypeSig typeSig, IList <TypeSig> typeGenArgs, IList <TypeSig> methodGenArgs)
        {
            if (typeSig == null)
            {
                return(typeSig);
            }
            if (typeGenArgs == null && methodGenArgs == null)
            {
                return(typeSig);
            }

            var resolver = new GenericArgumentResolver();

            resolver.genericArguments = new GenericArguments();
            resolver.recursionCounter = new RecursionCounter();

            if (typeGenArgs != null)
            {
                resolver.genericArguments.PushTypeArgs(typeGenArgs);
            }

            if (methodGenArgs != null)
            {
                resolver.genericArguments.PushMethodArgs(methodGenArgs);
            }

            return(resolver.ResolveGenericArgs(typeSig));
        }
예제 #2
0
        /// <summary>
        /// Resolves the method signature with the specified generic arguments.
        /// </summary>
        /// <param name="methodSig">The method signature.</param>
        /// <param name="typeGenArgs">The type generic arguments.</param>
        /// <param name="methodGenArgs">The method generic arguments.</param>
        /// <returns>Resolved method signature.</returns>
        /// <exception cref="System.ArgumentException">No generic arguments to resolve.</exception>
        public static MethodBaseSig?Resolve(MethodBaseSig?methodSig, IList <TypeSig>?typeGenArgs, IList <TypeSig>?methodGenArgs)
        {
            if (methodSig is null)
            {
                return(null);
            }
            if ((typeGenArgs is null || typeGenArgs.Count == 0) && (methodGenArgs is null || methodGenArgs.Count == 0))
            {
                return(methodSig);
            }

            var resolver = new GenericArgumentResolver(typeGenArgs, methodGenArgs);

            return(resolver.ResolveGenericArgs(methodSig));
        }
예제 #3
0
        /// <summary>
        /// Resolves the type signature with the specified generic arguments.
        /// </summary>
        /// <param name="typeSig">The type signature.</param>
        /// <param name="typeGenArgs">The type generic arguments.</param>
        /// <param name="methodGenArgs">The method generic arguments.</param>
        /// <returns>Resolved type signature.</returns>
        /// <exception cref="System.ArgumentException">No generic arguments to resolve.</exception>
        public static TypeSig Resolve(TypeSig typeSig, IList <TypeSig> typeGenArgs, IList <TypeSig> methodGenArgs)
        {
            if (typeSig == null)
            {
                return(typeSig);
            }
            if ((typeGenArgs == null || typeGenArgs.Count == 0) && (methodGenArgs == null || methodGenArgs.Count == 0))
            {
                return(typeSig);
            }

            var resolver = new GenericArgumentResolver(typeGenArgs, methodGenArgs);

            return(resolver.ResolveGenericArgs(typeSig));
        }