Table of Contents

Class SemanticContextFlagsBuilder<TContext, TFlags>

Namespace
RDCore.SDK.Semantics.Builders
Assembly
RDCore.SDK.dll

Builds the semantic flags of a specific semantic operation.

public record SemanticContextFlagsBuilder<TContext, TFlags> : ISemanticContextFlagsBuilder<TContext, TFlags>, ISemanticContextContributor<TContext, TFlags>, ISemanticFlagsAccumulator<TFlags>, IEquatable<SemanticContextFlagsBuilder<TContext, TFlags>> where TContext : SemanticContext<TFlags>, new() where TFlags : struct, Enum

Type Parameters

TContext

The type of SemanticContext to build.

TFlags

A [Flags] enum type with bit-shifted members that can be composed to encode the semantic flags of the context.

Inheritance
SemanticContextFlagsBuilder<TContext, TFlags>
Implements
ISemanticContextContributor<TContext, TFlags>
Derived
Inherited Members

Properties

Flags

Builds the current aggregate flags and returns the result.

public TFlags Flags { get; }

Property Value

TFlags

Remarks

🧩 This property enumerates and casts all flags to compute the current aggregate flags value every time it is invoked. Avoid calling it repeatedly.

Methods

AddFlags(TFlags)

Adds the specified semantic flag(s) to the context.

public ISemanticFlagsAccumulator<TFlags> AddFlags(TFlags flags)

Parameters

flags TFlags

The semantic flag values.

Returns

ISemanticFlagsAccumulator<TFlags>

AddLetCoercionFlags(ConversionSemanticFlags, InputIndex)

Adds the specified conversion semantic flag(s) to the let-coercion of the specified operand; the flags of one operand accumulate across calls, and are kept apart from the other operands'.

public virtual ISemanticFlagsAccumulator<TFlags> AddLetCoercionFlags(ConversionSemanticFlags flags, InputIndex operand)

Parameters

flags ConversionSemanticFlags

The conversion flag(s) to add.

operand InputIndex

The operand whose let-coercion the flags describe.

Returns

ISemanticFlagsAccumulator<TFlags>

Remarks

The flags are read back per operand with LetCoercionFlagsOf(InputIndex). A builder whose own flags are conversion flags (LetCoercionSemanticContextFlagsBuilder) also contributes them to its Flags: they describe the operation's conversion just as much as they describe the operand's.

AddOnError<TError>(TError?)

Adds the specified error to the semantic context if it isn't null.

public ISemanticContextFlagsBuilder<TContext, TFlags> AddOnError<TError>(TError? error) where TError : VBErrorInfo

Parameters

error TError

Holds information about an error.

Returns

ISemanticContextFlagsBuilder<TContext, TFlags>

Type Parameters

TError

The specific type of VBErrorInfo encapsulating the error metadata.

Build()

Builds and returns an immutable SemanticContext instance from the current builder state.

public virtual TContext Build()

Returns

TContext

Remarks

👉 The context of an operator expression also holds the conversion semantic context of each operand (OperandConversionContexts), built from the flags added with AddLetCoercionFlags(ConversionSemanticFlags, InputIndex).

LetCoercionFlagsOf(InputIndex)

Gets the conversion semantic flags added so far to the let-coercion of the specified operand.

public ConversionSemanticFlags LetCoercionFlagsOf(InputIndex operand)

Parameters

operand InputIndex

The operand to read the flags of.

Returns

ConversionSemanticFlags

The accumulated flags, or none if nothing was added for that operand.

WithFlags(TFlags)

Adds the specified semantic flag(s) to the context and returns the builder instance.

protected ISemanticFlagsAccumulator<TFlags> WithFlags(TFlags flags)

Parameters

flags TFlags

The semantic flag value(s) to compose into the semantic context.

Returns

ISemanticFlagsAccumulator<TFlags>