internal GenericTypeSlim4(GenericDefinitionTypeSlim typeDefinition, TypeSlim argument1, TypeSlim argument2, TypeSlim argument3, TypeSlim argument4)
     : base(typeDefinition, argument1)
 {
     _argument2 = argument2;
     _argument3 = argument3;
     _argument4 = argument4;
 }
예제 #2
0
        /// <summary>
        /// Creates a new lightweight representation of a closed generic type.
        /// </summary>
        /// <param name="typeDefinition">Generic type definition.</param>
        /// <param name="arguments">Generic type arguments.</param>
        /// <returns>A new lightweight representation of a closed generic type.</returns>
        public static GenericTypeSlim Generic(GenericDefinitionTypeSlim typeDefinition, ReadOnlyCollection <TypeSlim> arguments)
        {
            RequireNotNull(typeDefinition, nameof(typeDefinition));
            RequireNotNull(arguments, nameof(arguments));

            return(arguments.Count switch
            {
                1 => Generic(typeDefinition, arguments[0]),
                2 => Generic(typeDefinition, arguments[0], arguments[1]),
                3 => Generic(typeDefinition, arguments[0], arguments[1], arguments[2]),
                4 => Generic(typeDefinition, arguments[0], arguments[1], arguments[2], arguments[3]),
                _ => new GenericTypeSlimMany(typeDefinition, arguments),
            });
        internal override GenericTypeSlim Rewrite(GenericDefinitionTypeSlim typeDefinition, TypeSlim[] arguments)
        {
            Debug.Assert(typeDefinition != null);
            Debug.Assert(arguments == null || arguments.Length == 2);

            if (arguments == null)
            {
                return(TypeSlim.Generic(typeDefinition, Argument1, _argument2));
            }
            else
            {
                return(TypeSlim.Generic(typeDefinition, arguments[0], arguments[1]));
            }
        }
예제 #4
0
        internal override GenericTypeSlim Rewrite(GenericDefinitionTypeSlim typeDefinition, TypeSlim[] arguments)
        {
            Debug.Assert(typeDefinition != null);
            Debug.Assert(arguments == null || arguments.Length == GenericArgumentCount);

            // CONSIDER: Add a factory method overload with IEnumerable<TypeSlim>.

            if (arguments != null)
            {
                return(TypeSlim.Generic(typeDefinition, arguments));
            }
            else
            {
                return(TypeSlim.Generic(typeDefinition, GenericArguments));
            }
        }
예제 #5
0
 protected override string MakeGenericDefinition(GenericDefinitionTypeSlim type)
 {
     return(string.Format(CultureInfo.InvariantCulture, "{0}", type.Name));
 }
예제 #6
0
 /// <summary>
 /// Creates a new closed generic type representation object.
 /// </summary>
 /// <param name="typeDefinition">Generic type definition.</param>
 /// <param name="arguments">Generic type arguments.</param>
 internal GenericTypeSlimMany(GenericDefinitionTypeSlim typeDefinition, ReadOnlyCollection <TypeSlim> arguments)
     : base(typeDefinition)
 {
     GenericArguments = arguments;
 }
예제 #7
0
 /// <summary>
 /// Called by the visitor to update the node.
 /// </summary>
 /// <param name="typeDefinition">The new generic type definition.</param>
 /// <param name="arguments">The new generic type arguments, or null if the current type arguments have to be copied.</param>
 /// <returns>The updated node.</returns>
 internal abstract GenericTypeSlim Rewrite(GenericDefinitionTypeSlim typeDefinition, TypeSlim[] arguments);
예제 #8
0
 /// <summary>
 /// Creates a new closed generic type representation object.
 /// </summary>
 /// <param name="typeDefinition">Generic type definition.</param>
 internal GenericTypeSlim(GenericDefinitionTypeSlim typeDefinition)
 {
     GenericTypeDefinition = typeDefinition;
 }
예제 #9
0
 public GenericTypeSlimN(GenericDefinitionTypeSlim typeDefinition, TypeSlim argument1)
     : base(typeDefinition)
 {
     _argument1 = argument1;
 }
 internal GenericTypeSlim2(GenericDefinitionTypeSlim typeDefinition, TypeSlim argument1, TypeSlim argument2)
     : base(typeDefinition, argument1)
 {
     _argument2 = argument2;
 }
 internal GenericTypeSlim1(GenericDefinitionTypeSlim typeDefinition, TypeSlim argument1)
     : base(typeDefinition, argument1)
 {
 }
예제 #12
0
 /// <summary>
 /// Visits an open generic type definition.
 /// </summary>
 /// <param name="type">Type to visit.</param>
 /// <returns>Result of the visit.</returns>
 protected virtual TypeSlim VisitGenericDefinition(GenericDefinitionTypeSlim type)
 {
     return(type);
 }