protected AbstractTypeParameter(ICompilation compilation, EntityType ownerType, int index, string name, VarianceModifier variance, IList <IAttribute> attributes, DomRegion region) { if (compilation == null) { throw new ArgumentNullException("compilation"); } this.compilation = compilation; this.ownerType = ownerType; this.index = index; this.name = name ?? ((this.OwnerType == EntityType.Method ? "!!" : "!") + index.ToString(CultureInfo.InvariantCulture)); this.attributes = attributes ?? EmptyList <IAttribute> .Instance; this.region = region; this.variance = variance; }
protected AbstractTypeParameter(IEntity owner, int index, string name, VarianceModifier variance, IReadOnlyList <IAttribute> attributes) { if (owner == null) { throw new ArgumentNullException("owner"); } this.owner = owner; this.compilation = owner.Compilation; this.ownerType = owner.SymbolKind; this.index = index; this.name = name ?? ((this.OwnerType == SymbolKind.Method ? "!!" : "!") + index.ToString(CultureInfo.InvariantCulture)); this.attributes = attributes ?? EmptyList <IAttribute> .Instance; this.variance = variance; }
private static int ConvertVarianceToInt(VarianceModifier variance) { switch (variance) { case VarianceModifier.Covariant: return(1); case VarianceModifier.Contravariant: return(2); default: return(0); } }
public DefaultTypeParameter( ICompilation compilation, EntityType ownerType, int index, string name = null, VarianceModifier variance = VarianceModifier.Invariant, IList <IAttribute> attributes = null, DomRegion region = default(DomRegion), bool hasValueTypeConstraint = false, bool hasReferenceTypeConstraint = false, bool hasDefaultConstructorConstraint = false, IList <IType> constraints = null) : base(compilation, ownerType, index, name, variance, attributes, region) { this.hasValueTypeConstraint = hasValueTypeConstraint; this.hasReferenceTypeConstraint = hasReferenceTypeConstraint; this.hasDefaultConstructorConstraint = hasDefaultConstructorConstraint; this.constraints = constraints ?? EmptyList <IType> .Instance; }
public DefaultTypeParameter( ICompilation compilation, SymbolKind ownerType, int index, string name = null, VarianceModifier variance = VarianceModifier.Invariant, IList<IAttribute> attributes = null, DomRegion region = default(DomRegion), bool hasValueTypeConstraint = false, bool hasReferenceTypeConstraint = false, bool hasDefaultConstructorConstraint = false, IList<IType> constraints = null) : base(compilation, ownerType, index, name, variance, attributes, region) { this.hasValueTypeConstraint = hasValueTypeConstraint; this.hasReferenceTypeConstraint = hasReferenceTypeConstraint; this.hasDefaultConstructorConstraint = hasDefaultConstructorConstraint; this.constraints = constraints ?? EmptyList<IType>.Instance; }
public DefaultTypeParameter( ICompilation compilation, SymbolKind ownerType, int index, string name = null, VarianceModifier variance = VarianceModifier.Invariant, IReadOnlyList <IAttribute> attributes = null, bool hasValueTypeConstraint = false, bool hasReferenceTypeConstraint = false, bool hasDefaultConstructorConstraint = false, IReadOnlyList <IType> constraints = null) : base(compilation, ownerType, index, name, variance) { this.hasValueTypeConstraint = hasValueTypeConstraint; this.hasReferenceTypeConstraint = hasReferenceTypeConstraint; this.hasDefaultConstructorConstraint = hasDefaultConstructorConstraint; this.constraints = constraints ?? EmptyList <IType> .Instance; this.attributes = attributes ?? EmptyList <IAttribute> .Instance; }
public DefaultTypeParameter( IEntity owner, int index, string name = null, VarianceModifier variance = VarianceModifier.Invariant, IReadOnlyList <IAttribute> attributes = null, bool hasValueTypeConstraint = false, bool hasReferenceTypeConstraint = false, bool hasDefaultConstructorConstraint = false, IReadOnlyList <IType> constraints = null, Nullability nullabilityConstraint = Nullability.Oblivious) : base(owner, index, name, variance) { this.hasValueTypeConstraint = hasValueTypeConstraint; this.hasReferenceTypeConstraint = hasReferenceTypeConstraint; this.hasDefaultConstructorConstraint = hasDefaultConstructorConstraint; this.nullabilityConstraint = nullabilityConstraint; this.TypeConstraints = MakeConstraints(constraints); this.attributes = attributes ?? EmptyList <IAttribute> .Instance; }
static void AppendVariance (StringBuilder sb, VarianceModifier variance) { if (variance == VarianceModifier.Contravariant) { sb.Append ("in "); } else if (variance == VarianceModifier.Covariant) { sb.Append ("out "); } }
protected AbstractTypeParameter(ICompilation compilation, SymbolKind ownerType, int index, string name, VarianceModifier variance) { if (compilation == null) { throw new ArgumentNullException("compilation"); } this.compilation = compilation; this.ownerType = ownerType; this.index = index; this.name = name ?? ((this.OwnerType == SymbolKind.Method ? "!!" : "!") + index.ToString(CultureInfo.InvariantCulture)); this.variance = variance; }
void AppendVariance (StringBuilder sb, VarianceModifier variance) { if (variance == VarianceModifier.Contravariant) { sb.Append (Highlight ("in ", colorStyle.KeywordParameter)); } else if (variance == VarianceModifier.Covariant) { sb.Append (Highlight ("out ", colorStyle.KeywordParameter)); } }