Class UnbuiltExpressionTriviaNode
Preserves the raw source text of an expression alternative the grammar recognizes but that
has no dedicated AST node yet (e.g. New <class>, TypeOf <expr> Is <type>).
public sealed record UnbuiltExpressionTriviaNode : ExpressionNode, IEquatable<SyntaxNode>, IExecutableNode, IEquatable<ExpressionNode>, IEquatable<UnbuiltExpressionTriviaNode>
- Inheritance
-
UnbuiltExpressionTriviaNode
- Implements
- Inherited Members
Remarks
The AST must stay a faithful, lossless representation of the source even where a proper semantic node doesn't exist yet — silently building a different, wrong-meaning node in its place (or building nothing at all) would misrepresent the source rather than merely under-represent it. Inputs keeps whatever the grammar's own sub-expression already built (so nothing the walk already parsed is thrown away), and Source is the exact original text — together they let a consumer that needs to reconstruct the source (e.g. a formatter) do so verbatim, while a consumer that only cares about semantics can tell at a glance that this position wasn't modeled.
Constructors
UnbuiltExpressionTriviaNode(SyntaxNodeId, SourceLocation, string, ImmutableArray<SyntaxNode>)
Preserves the raw source text of an expression alternative the grammar recognizes but that
has no dedicated AST node yet (e.g. New <class>, TypeOf <expr> Is <type>).
public UnbuiltExpressionTriviaNode(SyntaxNodeId Identity, SourceLocation Location, string Source, ImmutableArray<SyntaxNode> Inputs)
Parameters
IdentitySyntaxNodeIdA unique identifier for this specific syntax node.
LocationSourceLocationThe document location (
Uri+Range) of the unbuilt expression.SourcestringThe exact original source text of the unbuilt expression.
InputsImmutableArray<SyntaxNode>Whatever sub-expression(s) the grammar's own walk already built underneath it.
Remarks
The AST must stay a faithful, lossless representation of the source even where a proper semantic node doesn't exist yet — silently building a different, wrong-meaning node in its place (or building nothing at all) would misrepresent the source rather than merely under-represent it. Inputs keeps whatever the grammar's own sub-expression already built (so nothing the walk already parsed is thrown away), and Source is the exact original text — together they let a consumer that needs to reconstruct the source (e.g. a formatter) do so verbatim, while a consumer that only cares about semantics can tell at a glance that this position wasn't modeled.
Properties
Source
The exact original source text of the unbuilt expression.
public string Source { get; init; }