Esempio n. 1
0
        /// <summary>
        /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>,
        /// <paramref name="typeReferences"/> and <paramref name="requiresConstructor"/> provided.
        /// </summary>
        /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
        /// <param name="typeReferences">The series of <see cref="ITypeReference"/>s
        /// which denote the constraints set forth on the <see cref="TypeConstrainedName"/>.</param>
        /// <param name="requiresConstructor">Whether the <see cref="TypeConstrainedName"/>
        /// requires an empty-parameter constructor.</param>
        public TypeConstrainedName(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition, params ITypeReference[] typeReferences)
        {
            this.name = name;
            bool valueTypeConstraint = false;

            typeReferences.Where(d =>
            {
                bool isValueType = false;
                if (d is IExternTypeReference)
                {
                    if (((IExternTypeReference)d).TypeInstance.Type == typeof(ValueType))
                    {
                        valueTypeConstraint = isValueType = true;
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
                return(!(isValueType));
            });
            this.typeReferences = typeReferences.Where(d =>
            {
                bool isValueType = false;
                if (d is IExternTypeReference)
                {
                    if (((IExternTypeReference)d).TypeInstance.Type == typeof(ValueType))
                    {
                        valueTypeConstraint = isValueType = true;
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
                return(!(isValueType));
            }).ToArray();

            this.requiresConstructor = requiresConstructor;
            if (specialCondition == TypeParameterSpecialCondition.None && valueTypeConstraint)
            {
                this.specialCondition = TypeParameterSpecialCondition.ValueType;
            }
            else
            {
                this.specialCondition = specialCondition;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Adds a new <typeparamref name="TItem"/> with the <paramref name="name"/> provided.
 /// </summary>
 /// <param name="name">The name of the constraint.</param>
 /// <returns>A new <typeparamref name="TItem"/> named <paramref name="name"/>.</returns>
 public override ITypeParameterMember <TParentDom> AddNew(string name, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(name, false, specialCondition));
 }
Esempio n. 3
0
 public override IMethodTypeParameterMember AddNew(string name, ITypeReference[] constraints, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(name, new TypeReferenceCollection(constraints), requiresConstructor, specialCondition));
 }
Esempio n. 4
0
        public override IMethodTypeParameterMember AddNew(string name, ITypeReferenceCollection constraints, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
        {
            MethodTypeParameterMember result = new MethodTypeParameterMember(name, (IMethodMember)this.TargetDeclaration);

            result.Constraints.AddRange(constraints.ToArray());
            result.SpecialCondition    = specialCondition;
            result.RequiresConstructor = requiresConstructor;
            this._Add(result.GetUniqueIdentifier(), result);
            this.OnSignatureChanged();
            return(result);
        }
Esempio n. 5
0
 public override IMethodTypeParameterMember AddNew(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(name, new ITypeReference[0], requiresConstructor, specialCondition));
 }
Esempio n. 6
0
 public override IMethodTypeParameterMember AddNew(string name, TypeParameterSpecialCondition specialCondition)
 {
     return(AddNew(name, false, specialCondition));
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>
 /// and <paramref name="requiresConstructor"/> provided.
 /// </summary>
 /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="requiresConstructor">Whether the <see cref="TypeConstrainedName"/>
 /// requires an empty-parameter constructor.</param>
 public TypeConstrainedName(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
     : this(name, requiresConstructor, specialCondition, new ITypeReference[0])
 {
 }
Esempio n. 8
0
        /// <summary>
        /// Adds a new <typeparamref name="TItem"/> with the <paramref name="name"/>, <paramref name="constraints"/>,
        /// and <paramref name="requiresConstructor"/> provided.
        /// </summary>
        /// <param name="name">The name of the constraint.</param>
        /// <param name="constraints">The type-reference constraints for the resulted <paramref name="TItem"/>.</param>
        /// <param name="requiresConstructor">Whether or not the resulted <typeparamref name="TItem"/>
        /// has a null-constructor constraint.</param>
        /// <returns>A new <typeparamref name="TItem"/> named <paramref name="name"/> and
        /// has the null constructor constraint based upon <paramref name="requiresConstructor"/>
        /// and additional constraints as expressed by <paramref name="constraints"/>.</returns>
        public override ITypeParameterMember <TParentDom> AddNew(string name, ITypeReferenceCollection constraints, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
        {
            TypeParameterMember <TParentDom> item = new TypeParameterMember <TParentDom>(name, this.TargetDeclaration);

            item.RequiresConstructor = requiresConstructor;
            item.Constraints.AddRange(constraints.ToArray());
            item.SpecialCondition = specialCondition;
            this._Add(item.Name, item);
            return(item);
        }
Esempio n. 9
0
 public abstract TItem AddNew(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition);
Esempio n. 10
0
 public abstract TItem AddNew(string name, TypeParameterSpecialCondition specialCondition);
Esempio n. 11
0
 /// <summary>
 /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>,
 /// <paramref name="typeReferences"/> and <paramref name="requiresConstructor"/> provided.
 /// </summary>
 /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="typeReferences">The series of <see cref="IType"/>s that are strung
 /// together into <see cref="ITypeReference"/>s which denote the constraints
 /// set forth on the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="requiresConstructor">Whether the <see cref="TypeConstrainedName"/>
 /// requires an empty-parameter constructor.</param>
 public TypeConstrainedName(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition, params IType[] typeReferences)
     : this(name, requiresConstructor, specialCondition, CodeGeneratorHelper.GetTypeReferences(typeReferences))
 {
 }
Esempio n. 12
0
 /// <summary>
 /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>
 /// and <paramref name="requiresConstructor"/>
 /// provided.
 /// </summary>
 /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="typeReferences">The series of <see cref="Type"/>s that are strung
 /// together into <see cref="ITypeReference"/>s which denote the constraints
 /// set forth on the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="requiresConstructor">Whether the <see cref="TypeConstrainedName"/>
 /// requires an empty-parameter constructor.</param>
 public TypeConstrainedName(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition, params Type[] typeReferences)
     : this(name, requiresConstructor, specialCondition, typeReferences.GetTypeReferences())
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>
 /// and <paramref name="typeReferences"/>
 /// provided.
 /// </summary>
 /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
 /// <param name="typeReferences">The series of <see cref="Type"/>s that are strung
 /// together into <see cref="ITypeReference"/>s which denote the constraints
 /// set forth on the <see cref="TypeConstrainedName"/>.</param>
 public TypeConstrainedName(string name, TypeParameterSpecialCondition specialCondition, params Type[] typeReferences)
     : this(name, false, specialCondition, typeReferences)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// Adds a new <typeparamref name="TItem"/> with the <paramref name="name"/>
 /// and <paramref name="requiresConstructor"/> provided.
 /// </summary>
 /// <param name="name">The name of the constraint.</param>
 /// <param name="requiresConstructor">Whether or not the resulted <typeparamref name="TItem"/>
 /// has a null-constructor constraint.</param>
 /// <returns>A new <typeparamref name="TItem"/> named <paramref name="name"/> and
 /// has the null constructor constraint based upon <paramref name="requiresConstructor"/>.</returns>
 public override ITypeParameterMember <TParentDom> AddNew(string name, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(name, new TypeReferenceCollection(), requiresConstructor, specialCondition));
 }
Esempio n. 15
0
 public abstract TItem AddNew(string name, ITypeReferenceCollection constraints, TypeParameterSpecialCondition specialCondition);
Esempio n. 16
0
 /// <summary>
 /// Adds a new <typeparamref name="TItem"/> with the <paramref name="name"/> and
 /// <paramref name="constraints"/> provided.
 /// </summary>
 /// <param name="name">The name of the constraint.</param>
 /// <param name="constraints">The type-reference constraints for the resulted <paramref name="TItem"/>.</param>
 /// <returns>A new <typeparamref name="TItem"/> named <paramref name="name"/> and
 /// constraints as expressed by <paramref name="constraints"/>..</returns>
 public override ITypeParameterMember <TParentDom> AddNew(string name, ITypeReferenceCollection constraints, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(name, constraints, false, specialCondition));
 }
Esempio n. 17
0
 public abstract TItem AddNew(string name, ITypeReference[] constraints, bool requiresConstructor, TypeParameterSpecialCondition specialCondition);
Esempio n. 18
0
 public override ITypeParameterMember <TParentDom> AddNew(string name, ITypeReference[] constraints, bool requiresConstructor, TypeParameterSpecialCondition specialCondition)
 {
     return(this.AddNew(new TypeConstrainedName(name, requiresConstructor, specialCondition, constraints)));
 }
Esempio n. 19
0
 /// <summary>
 /// Creates a new instance of <see cref="TypeConstrainedName"/> with the <paramref name="name"/>
 /// provided.
 /// </summary>
 /// <param name="name">The name of the <see cref="TypeConstrainedName"/>.</param>
 public TypeConstrainedName(string name, TypeParameterSpecialCondition specialCondition)
     : this(name, false, specialCondition, new ITypeReference[0])
 {
 }