Boo.Lang.Compiler.TypeSystem.GenericParameterInferrer.Run C# (CSharp) Method

Run() public method

public Run ( ) : bool
return bool
        public bool Run()
        {
            InferenceStart();

            if (Arguments.Count != GenericMethod.GetParameters().Length)
            {
                return InferenceComplete(false);
            }

            InferExplicits();

            while (HasUnfixedTypes())
            {
                bool wasFixed = FixAll(HasNoDependencies) || FixAll(HasDependantsAndBounds);
                if (!wasFixed)
                {
                    return InferenceComplete(false);
                }
                InferCallables();
            };

            return InferenceComplete(true);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Attempts to infer the generic parameters of a method from a set of arguments.
        /// </summary>
        /// <returns>
        /// An array consisting of inferred types for the method's generic arguments,
        /// or null if type inference failed.
        /// </returns>
        public IType[] InferMethodGenericArguments(IMethod method, ExpressionCollection arguments)
        {
            if (method.GenericInfo == null) return null;

            GenericParameterInferrer inferrerr = new GenericParameterInferrer(Context, method, arguments);
            if (inferrerr.Run())
            {
                return inferrerr.GetInferredTypes();
            }
            return null;
        }