Table of Contents

Enum InstructionKind

Namespace
RDCore.SDK.Semantics.Instructions
Assembly
RDCore.SDK.dll

Discriminates the control-flow shape of an Instruction within an InstructionList — RD-VBAL §3.5.

public enum InstructionKind

Fields

Break = 8

Stop (MS-VBAL §5.4.2.11): suspends execution for a debugger to resume.

ConditionalBranch = 9

An If/ElseIf header, a pre-test loop header (Do While/Do Until/ While…Wend), or a Select Case Case header: evaluates Node (a boolean condition, or a case match against the selector Matching names); on match/true, falls through; otherwise branches to Else.

ExitLoop = 17

Exit For/Exit Do (MS-VBAL §5.4.2.5, §5.4.2.7): branches to Target, the offset right past the innermost enclosing loop of the matching kind's closer, or null when lowering found no such enclosing loop.

ExitProcedure = 6

Exit Sub/Exit Function/Exit Property (MS-VBAL §5.4.2.17– §5.4.2.19): ends the current activation as if execution had reached the end of its body.

ForEachNext = 14

A For Each loop's Next closer: advances the enumerator; while it still has an element, branches back to Target (the body's first instruction); otherwise falls through, ending the loop.

ForEachOpener = 13

A For Each loop's opener (MS-VBAL §5.4.2.4): evaluates the collection expression into a per-activation enumerator. Always falls through into the body.

ForNext = 12

A For loop's Next closer: advances the counter by the step and tests it against the end bound; while still in range, branches back to Target (the body's first instruction); otherwise falls through, ending the loop. A jump directly to a Next whose opener never ran is MS-VBAL §5.4.2.3 error 92, "For loop not initialized" — a runtime concern, not lowering's.

ForOpener = 11

A For loop's opener (MS-VBAL §5.4.2.3): evaluates the start/end/step expressions into per-activation hidden state. Always falls through into the body.

GoSub = 3

GoSub (MS-VBAL §5.4.2.14): pushes the offset right after this instruction onto the activation's own GoSub Resumption List, then branches unconditionally to Target — everything Jump does, plus the push.

GoSubTable = 5

An indexed branch that also pushes a resumption point (On…GoSub, MS-VBAL §5.4.2.16) to one of Targets, selected at runtime — everything JumpTable does, plus the same push GoSub does on a successful branch; an out-of-range selector falls through without pushing anything.

Halt = 7

End (not a MS-VBAL-numbered statement): halts the whole program.

Jump = 1

An unconditional branch (GoTo, MS-VBAL §5.4.2.12; also a bare Do…Loop's back-edge, and the synthesized jump a lowered If/ElseIf/Else or Case/Case Else branch ends with) to Target.

JumpTable = 2

An indexed branch (On…GoTo, MS-VBAL §5.4.2.13) to one of Targets, selected at runtime; an out-of-range selector falls through instead.

LoopBack = 10

A post-test loop's closer (Do…Loop While/Do…Loop Until, MS-VBAL §5.4.2.6): evaluates Node's condition; when the loop should continue, branches back to Target (the body's first instruction); otherwise falls through, ending the loop.

OnErrorDisable = 19

On Error GoTo 0 (or the undocumented VBA6/7 On Error GoTo -1) — disables the activation's error-handling policy and clears any active error. Always falls through.

OnErrorGoTo = 18

On Error GoTo <label> (MS-VBAL §5.4.4.1): sets the activation's error-handling policy to branch to Target on the next error. Always falls through — the branch only happens later, when (if) an error is actually raised.

OnErrorResumeNext = 20

On Error Resume Next (MS-VBAL §5.4.4.1): sets the activation's error-handling policy to silently continue at the statement after any statement that raises an error. Always falls through.

RaiseError = 24

Error <number> (MS-VBAL §5.4.4.3): raises the given number as a run-time error, "as if the Err.Raise method were invoked" with it.

ResumeCurrentStatement = 21

A bare Resume, or Resume 0 (MS-VBAL §5.4.4.2): re-executes the statement whose fault raised the activation's active error, and clears it. No active error is error 20, "Resume without error".

ResumeLabel = 23

Resume <label> (MS-VBAL §5.4.4.2): branches to Target and clears the activation's active error. No active error is error 20, "Resume without error".

ResumeNext = 22

Resume Next (MS-VBAL §5.4.4.2): continues at the statement right after the one whose fault raised the activation's active error, and clears it. No active error is error 20, "Resume without error".

Return = 4

Return (MS-VBAL §5.4.2.15): pops the activation's own GoSub Resumption List and branches to the popped offset. An empty list is error 3, "Return without GoSub".

Select = 16

A Select Case block's opener (MS-VBAL §5.4.2.10): evaluates the control expression into per-activation hidden state each Case header — an Instruction whose Matching names this opener's offset — compares against. Always falls through into the first Case header, or past the block when it declares none.

Simple = 0

Falls through to the following offset. Every statement kind not covered by another member of this enum lowers as Simple.

With = 15

A With block's opener (MS-VBAL §5.4.2.21): evaluates the with-expression into per-activation hidden state that every instruction lexically inside the block reads through EnclosingWith. Always falls through into the body.

Remarks

A statement's own runtime semantics stay pure (RD-VBAL §3.5: they never mutate control state); InstructionKind only tells the interpreter's fetch/decode loop which pre-resolved offset on Instruction to consult, and whether to consult it at all.