Boo.Lang.Compiler.TypeSystem.GenericConstructionChecker.IncorrectGenerity C# (CSharp) Method

IncorrectGenerity() public method

Checks if the number of generic parameters on a specified definition does not match the number of supplied type arguments.
public IncorrectGenerity ( IEntity definition ) : bool
definition IEntity
return bool
        public bool IncorrectGenerity(IEntity definition)
        {
            int parametersCount = GenericsServices.GetGenericParameters(definition).Length;
            if (parametersCount != TypeArguments.Length)
            {
                Errors.Add(CompilerErrorFactory.GenericDefinitionArgumentCount(ConstructionNode, definition.FullName, parametersCount));
                return true;
            }
            return false;
        }

Usage Example

Example #1
0
        /// <summary>
        /// Checks whether a given set of arguments can be used to construct a generic type or method from a specified definition.
        /// </summary>
        public bool CheckGenericConstruction(IEntity definition, Node node, TypeReferenceCollection arguments, CompilerErrorCollection errors)
        {
            GenericConstructionChecker checker = new GenericConstructionChecker(
                TypeSystemServices, node, arguments, Errors);

            return(!(
                       checker.NotGenericDefinition(definition) ||
                       checker.IncorrectGenerity(definition) ||
                       checker.ViolatesParameterConstraints(definition)));
        }
All Usage Examples Of Boo.Lang.Compiler.TypeSystem.GenericConstructionChecker::IncorrectGenerity