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

ViolatesParameterConstraints() public method

Checks if the given type arguments violate any constraints declared on the type parameters of a specified generic definition.
public ViolatesParameterConstraints ( IEntity definition ) : bool
definition IEntity
return bool
        public bool ViolatesParameterConstraints(IEntity definition)
        {
            IGenericParameter[] parameters = GenericsServices.GetGenericParameters(definition);

            bool valid = true;
            for (int i = 0; i < parameters.Length; i++)
            {
                if (ViolatesParameterConstraints(parameters[i], TypeArguments[i]))
                {
                    valid = false;
                }
            }

            return !valid;
        }

Same methods

GenericConstructionChecker::ViolatesParameterConstraints ( IGenericParameter parameter, IType argument ) : bool

Usage Example

Ejemplo n.º 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::ViolatesParameterConstraints