Table of Contents

Struct ForLoopState

Namespace
RDCore.SDK.Runtime.Shared
Assembly
RDCore.SDK.dll

The hidden per-activation state a For loop's opener stashes for its own closer to read back (MS-VBAL §5.4.2.3) — the end/step values are evaluated once, ahead of the loop, and read again on every Next without re-evaluating their source expressions.

public readonly record struct ForLoopState : IEquatable<ForLoopState>
Implements
Inherited Members

Constructors

ForLoopState(Symbol, ExpressionNode, VBTypedValue, VBTypedValue)

The hidden per-activation state a For loop's opener stashes for its own closer to read back (MS-VBAL §5.4.2.3) — the end/step values are evaluated once, ahead of the loop, and read again on every Next without re-evaluating their source expressions.

public ForLoopState(Symbol Counter, ExpressionNode ControlExpression, VBTypedValue End, VBTypedValue Step)

Parameters

Counter Symbol

The bound-variable-expression symbol the loop counts through.

ControlExpression ExpressionNode

The counter's own expression node, reused as the location-bearing node for every arithmetic/ let-assignment step a Next performs — never a synthetic stand-in.

End VBTypedValue

The loop's end-value, evaluated once and never re-evaluated.

Step VBTypedValue

The loop's step-increment, evaluated once and never re-evaluated.

Properties

ControlExpression

The counter's own expression node, reused as the location-bearing node for every arithmetic/ let-assignment step a Next performs — never a synthetic stand-in.

public ExpressionNode ControlExpression { get; init; }

Property Value

ExpressionNode

Counter

The bound-variable-expression symbol the loop counts through.

public Symbol Counter { get; init; }

Property Value

Symbol

CounterAssignment

The let-assignment of the counter on every Next, located at ControlExpression: made once for the loop rather than once for each iteration.

public VBBinaryOperatorExpressionNode CounterAssignment { get; }

Property Value

VBBinaryOperatorExpressionNode

CounterTarget

The counter, as the target its value is let-assigned to on every Next.

public VBSymbolDescValue CounterTarget { get; }

Property Value

VBSymbolDescValue

CountsDown

Whether Step is negative: the loop counts down to End, and completes when the counter falls below it, rather than up to it. Known once, as the step is.

public bool CountsDown { get; init; }

Property Value

bool

End

The loop's end-value, evaluated once and never re-evaluated.

public VBTypedValue End { get; init; }

Property Value

VBTypedValue

RuntimeState

What the runtime that runs the loop keeps of it from one Next to the next - what it would otherwise work out again on every iteration, of values that do not change while the loop runs (the end, the step, the counter's binding). Opaque here: the runtime that sets it is the one that reads it, and null means it keeps nothing.

public object? RuntimeState { get; init; }

Property Value

object

Step

The loop's step-increment, evaluated once and never re-evaluated.

public VBTypedValue Step { get; init; }

Property Value

VBTypedValue