internal GenericTypeSlim4(GenericDefinitionTypeSlim typeDefinition, TypeSlim argument1, TypeSlim argument2, TypeSlim argument3, TypeSlim argument4) : base(typeDefinition, argument1) { _argument2 = argument2; _argument3 = argument3; _argument4 = argument4; }
/// <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])); } }
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)); } }
protected override string MakeGenericDefinition(GenericDefinitionTypeSlim type) { return(string.Format(CultureInfo.InvariantCulture, "{0}", type.Name)); }
/// <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; }
/// <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);
/// <summary> /// Creates a new closed generic type representation object. /// </summary> /// <param name="typeDefinition">Generic type definition.</param> internal GenericTypeSlim(GenericDefinitionTypeSlim typeDefinition) { GenericTypeDefinition = typeDefinition; }
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) { }
/// <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); }