Class SourceGenTypeShape<T>
- Namespace
- PolyType.SourceGenModel
- Assembly
- PolyType.dll
Source generator model for type shapes.
public abstract class SourceGenTypeShape<T> : ITypeShape<T>, ITypeShape
Type Parameters
TThe type that the shape describes.
- Inheritance
-
SourceGenTypeShape<T>
- Implements
-
ITypeShape<T>
- Derived
- Inherited Members
Properties
AttributeFactory
Gets the factory method for creating the custom attribute provider of the type.
public Func<SourceGenAttributeInfo[]>? AttributeFactory { get; init; }
Property Value
EventsFactory
Gets the factory method for creating event shapes.
public Func<IEnumerable<IEventShape>>? EventsFactory { get; init; }
Property Value
GetAssociatedTypeShape
Gets the function that looks up associated type shapes by type.
public Func<Type, ITypeShape?>? GetAssociatedTypeShape { get; init; }
Property Value
IsContextual
Gets a value indicating whether this is a contextual view rather than the provider's ordinary representation of Type.
public bool IsContextual { get; init; }
Property Value
Remarks
Contextual shapes describe views specific to a structural role, such as a union's BaseType or an F# union case's object representation. This value is fixed for the lifetime of the shape. A false value identifies the ordinary representation of a type for a given Provider; it does not imply that shape instances are interned or reference-equal.
For a fixed provider and builder configuration, a cache keyed by Type must only reuse or store results for non-contextual shapes. Contextual shapes must bypass those entries, including delayed results and cached exceptions, while their non-contextual child shapes can use the same cache. TypeCache and TypeGenerationContext enforce this rule. This does not prohibit caching contextual shapes with a key that distinguishes their representations.
The property describes the shape, not the result of an arbitrary operation on it. Consumers must separately account for configuration or state that changes a generated result.
Kind
Gets determines the TypeShapeKind that the current shape supports.
public abstract TypeShapeKind Kind { get; }
Property Value
MethodsFactory
Gets the factory method for creating method shapes.
public Func<IEnumerable<IMethodShape>>? MethodsFactory { get; init; }
Property Value
Provider
Gets the provider used to generate this instance.
public required ITypeShapeProvider Provider { get; init; }
Property Value
Methods
Accept(TypeShapeVisitor, object?)
Accepts a TypeShapeVisitor for type graph traversal.
public abstract object? Accept(TypeShapeVisitor visitor, object? state = null)
Parameters
visitorTypeShapeVisitorThe visitor to accept.
stateobjectThe state parameter to pass to the underlying visitor.