Table of Contents

Class SourceGenFunctionTypeShape<TFunction, TArgumentState, TResult>

Namespace
PolyType.SourceGenModel
Assembly
PolyType.dll

Source generator model for function type shapes.

public sealed class SourceGenFunctionTypeShape<TFunction, TArgumentState, TResult> : SourceGenTypeShape<TFunction>, IFunctionTypeShape<TFunction, TArgumentState, TResult>, ITypeShape<TFunction>, IFunctionTypeShape, ITypeShape where TArgumentState : IArgumentState

Type Parameters

TFunction

The function type.

TArgumentState

The mutable state type used for aggregating function arguments.

TResult

The return type of the underlying method.

Inheritance
SourceGenFunctionTypeShape<TFunction, TArgumentState, TResult>
Implements
IFunctionTypeShape<TFunction, TArgumentState, TResult>
ITypeShape<TFunction>
Inherited Members

Properties

ArgumentStateConstructor

Gets a delegate for creating argument state constructor.

public required Func<TArgumentState> ArgumentStateConstructor { get; init; }

Property Value

Func<TArgumentState>

CreateParametersFunc

Gets a factory method for creating parameter shapes.

public Func<IEnumerable<IParameterShape>>? CreateParametersFunc { get; init; }

Property Value

Func<IEnumerable<IParameterShape>>

FromAsyncDelegateFunc

Gets a delegate wrapping a generic user-defined async delegate into an instance of TFunction.

public Func<RefFunc<TArgumentState, ValueTask<TResult>>, TFunction>? FromAsyncDelegateFunc { get; init; }

Property Value

Func<RefFunc<TArgumentState, ValueTask<TResult>>, TFunction>

FromDelegateFunc

Gets a delegate wrapping a generic user-defined delegate into an instance of TFunction.

public Func<RefFunc<TArgumentState, TResult>, TFunction>? FromDelegateFunc { get; init; }

Property Value

Func<RefFunc<TArgumentState, TResult>, TFunction>

FunctionInvoker

Gets a delegate for invoking the function.

public required MethodInvoker<TFunction, TArgumentState, TResult> FunctionInvoker { get; init; }

Property Value

MethodInvoker<TFunction, TArgumentState, TResult>

IsAsync

Gets a value indicating whether the underlying function returns a Task or ValueTask.

public required bool IsAsync { get; init; }

Property Value

bool

IsVoidLike

Gets a value indicating whether the underlying function returns void, Task, or ValueTask.

public required bool IsVoidLike { get; init; }

Property Value

bool

Remarks

When true the ReturnType is reported as Unit,

Kind

Gets determines the TypeShapeKind that the current shape supports.

public override TypeShapeKind Kind { get; }

Property Value

TypeShapeKind

Parameters

Gets the shapes of the parameters accepted by the method.

public IReadOnlyList<IParameterShape> Parameters { get; }

Property Value

IReadOnlyList<IParameterShape>

ReturnType

Gets the shape of the return type of the method.

public required ITypeShape<TResult> ReturnType { get; init; }

Property Value

ITypeShape<TResult>

Methods

Accept(TypeShapeVisitor, object?)

Accepts a TypeShapeVisitor for type graph traversal.

public override object? Accept(TypeShapeVisitor visitor, object? state = null)

Parameters

visitor TypeShapeVisitor

The visitor to accept.

state object

The state parameter to pass to the underlying visitor.

Returns

object

The object result returned by the visitor.