Class RedimDeclarationNode
- Namespace
- RDCore.SDK.Model.AST.Declarations
- Assembly
- RDCore.SDK.dll
A single target of a body-level ReDim statement (MS-VBAL §5.4.3.3) — one node per
comma-separated declaration, child of the enclosing member node.
public record RedimDeclarationNode : StatementNode, IEquatable<SyntaxNode>, IExecutableNode, IEquatable<StatementNode>, IEquatable<RedimDeclarationNode>
- Inheritance
-
RedimDeclarationNode
- Implements
- Inherited Members
Remarks
A ReDim always re-dimensions a dynamic array. It re-dimensions an existing array
(a local, a parameter, or a module field) when the target name already resolves; an unqualified
name that resolves to nothing implicitly declares a local, which stays legal under
Option Explicit (a later analysis pass flags it, and turns it into an error under
Option Strict).
The RedimBoundsNode child carries the new dimensions; unlike a Dim array
clause these bounds are ordinary run-time expressions, not constant expressions, which is why they
are expression nodes rather than the verbatim text ArrayBoundsNode keeps. An
AsTypeExpressionNode child, when present, carries the optional As clause.
👉 It is a StatementNode as well as a declaration, and both halves are real: MS-VBAL files it under §5.4.3 statements because it executes where it appears — its bounds are evaluated then, and the array is resized then — while the name it may introduce is a declaration the symbol pass picks up from the same node. Being a statement is also what gets it lowered into the instruction list at all.
Constructors
RedimDeclarationNode(SyntaxNodeId, SourceLocation, ExpressionNode, ImmutableArray<SyntaxNode>, bool, string?)
A single target of a body-level ReDim statement (MS-VBAL §5.4.3.3) — one node per
comma-separated declaration, child of the enclosing member node.
public RedimDeclarationNode(SyntaxNodeId Identity, SourceLocation Location, ExpressionNode Target, ImmutableArray<SyntaxNode> Children, bool IsPreserve = false, string? TypeHint = null)
Parameters
IdentitySyntaxNodeIdA unique identifier for this specific syntax node.
LocationSourceLocationThe source location of the
ReDimtarget.TargetExpressionNodeThe expression the array is the value of, and the one the new array is written back through: a SimpleNameExpressionNode (
ReDim a(1)), or a MemberAccessExpressionNode (obj.Buffer,Me.Buffer,.Buffer).ChildrenImmutableArray<SyntaxNode>The RedimBoundsNode, and the AsTypeExpressionNode when an
Asclause is present.IsPreservebooltruewhen theReDimstatement has thePreservekeyword.TypeHintstringThe type-declaration character on the target name (e.g.
%inReDim n%(2)), if one was supplied.
Remarks
A ReDim always re-dimensions a dynamic array. It re-dimensions an existing array
(a local, a parameter, or a module field) when the target name already resolves; an unqualified
name that resolves to nothing implicitly declares a local, which stays legal under
Option Explicit (a later analysis pass flags it, and turns it into an error under
Option Strict).
The RedimBoundsNode child carries the new dimensions; unlike a Dim array
clause these bounds are ordinary run-time expressions, not constant expressions, which is why they
are expression nodes rather than the verbatim text ArrayBoundsNode keeps. An
AsTypeExpressionNode child, when present, carries the optional As clause.
👉 It is a StatementNode as well as a declaration, and both halves are real: MS-VBAL files it under §5.4.3 statements because it executes where it appears — its bounds are evaluated then, and the array is resized then — while the name it may introduce is a declaration the symbol pass picks up from the same node. Being a statement is also what gets it lowered into the instruction list at all.
Properties
AsType
The optional As clause, or null when the statement declared none.
[JsonIgnore]
public AsTypeExpressionNode? AsType { get; }
Property Value
Remarks
A computed view over Children, ignored on the wire so that the spine stays the one
property carrying the data: Children is this node's own constructor parameter, so a
serializer that dropped it as reconstructable from here would have nothing to rebuild it from.
Bounds
The dimensions this statement gives the array, or null when it declared none.
[JsonIgnore]
public RedimBoundsNode? Bounds { get; }
Property Value
Remarks
A computed view over Children, ignored on the wire so that the spine stays the one
property carrying the data: Children is this node's own constructor parameter, so a
serializer that dropped it as reconstructable from here would have nothing to rebuild it from.
IsPreserve
true when the ReDim statement has the Preserve keyword.
public bool IsPreserve { get; init; }
Property Value
IsSimpleName
Whether the target is a name that resolves to a symbol, and not an expression to evaluate: ReDim a(1), not ReDim obj.Buffer(1).
[JsonIgnore]
public bool IsSimpleName { get; }
Property Value
Location
The source location of the ReDim target.
public SourceLocation Location { get; init; }
Property Value
Name
The identifier the target names: the name itself, or the member of a member access.
[JsonIgnore]
public string Name { get; }
Property Value
Remarks
What the symbol pass looks for, to know whether a Target that is a simple name is a re-dimension of what it resolves to or an implicit declaration. Empty for a target that is neither, which only a recovered parse leaves.
Target
The expression the array is the value of, and the one the new array is written back through: a SimpleNameExpressionNode (ReDim a(1)), or a
MemberAccessExpressionNode (obj.Buffer, Me.Buffer, .Buffer).
public ExpressionNode Target { get; init; }
Property Value
TypeHint
The type-declaration character on the target name (e.g. % in ReDim n%(2)), if one was supplied.
public string? TypeHint { get; init; }