public ImmutabilityQuery( ImmutableTypeKind kind, ITypeSymbol type ) { Kind = kind; Type = type; }
private ImmutableTypeInfo( ImmutableTypeKind kind, INamedTypeSymbol type, ImmutableArray <bool> conditionalTypeParameters ) { Kind = kind; Type = type; m_conditionalTypeParameters = conditionalTypeParameters; }
public static ImmutableTypeInfo CreateWithAllConditionalTypeParameters( ImmutableTypeKind kind, INamedTypeSymbol type ) { ImmutableArray <bool> immutableTypeParameters = type .TypeParameters .Select(p => true) .ToImmutableArray(); return(new ImmutableTypeInfo( kind: kind, type: type, conditionalTypeParameters: immutableTypeParameters )); }
public static ImmutableTypeInfo Create( AnnotationsContext annotationsContext, ImmutableTypeKind kind, INamedTypeSymbol type ) { ImmutableArray <bool> immutableTypeParameters = type .TypeParameters .Select(p => annotationsContext.Objects.OnlyIf.IsDefined(p)) .ToImmutableArray(); return(new ImmutableTypeInfo( kind: kind, type: type, conditionalTypeParameters: immutableTypeParameters )); }
public ImmutableTypeInfo GetImmutableTypeInfo( INamedTypeSymbol type ) { // Check for [Immutable] etc. ImmutableTypeKind fromAttributes = GetImmutabilityFromAttributes(type); if (fromAttributes != ImmutableTypeKind.None) { return(ImmutableTypeInfo.Create( annotationsContext: m_annotationsContext, kind: fromAttributes, type: type )); } if (type.IsTupleType) { return(ImmutableTypeInfo.CreateWithAllConditionalTypeParameters( kind: ImmutableTypeKind.Total, type: type.OriginalDefinition )); } // Check if we were otherwise told that this type is immutable if (m_extraImmutableTypes.TryGetValue(type.OriginalDefinition, out ImmutableTypeInfo info)) { return(info); } return(ImmutableTypeInfo.Create( annotationsContext: m_annotationsContext, kind: ImmutableTypeKind.None, type: type )); }