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 = 8Stop(MS-VBAL §5.4.2.11): suspends execution for a debugger to resume.ConditionalBranch = 9An
If/ElseIfheader, a pre-test loop header (Do While/Do Until/While…Wend), or aSelect CaseCaseheader: evaluates Node (a boolean condition, or a case match against the selector Matching names); on match/true, falls through; otherwise branches to Else.ExitLoop = 17Exit 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, ornullwhen lowering found no such enclosing loop.ExitProcedure = 6Exit 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 = 14A
For Eachloop'sNextcloser: 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 = 13A
For Eachloop's opener (MS-VBAL §5.4.2.4): evaluates the collection expression into a per-activation enumerator. Always falls through into the body.ForNext = 12A
Forloop'sNextcloser: 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 aNextwhose opener never ran is MS-VBAL §5.4.2.3 error 92, "For loop not initialized" — a runtime concern, not lowering's.ForOpener = 11A
Forloop'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 = 3GoSub(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 = 5An 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 = 7End(not a MS-VBAL-numbered statement): halts the whole program.Jump = 1An unconditional branch (
GoTo, MS-VBAL §5.4.2.12; also a bareDo…Loop's back-edge, and the synthesized jump a loweredIf/ElseIf/ElseorCase/Case Elsebranch ends with) to Target.JumpTable = 2An 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 = 10A 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 = 19On Error GoTo 0(or the undocumented VBA6/7On Error GoTo -1) — disables the activation's error-handling policy and clears any active error. Always falls through.OnErrorGoTo = 18On 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 = 20On 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 = 24Error<number> (MS-VBAL §5.4.4.3): raises the given number as a run-time error, "as if theErr.Raisemethod were invoked" with it.ResumeCurrentStatement = 21A bare
Resume, orResume 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 = 23Resume<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 = 22Resume 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 = 4Return(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 = 16A
Select Caseblock's opener (MS-VBAL §5.4.2.10): evaluates the control expression into per-activation hidden state eachCaseheader — an Instruction whose Matching names this opener's offset — compares against. Always falls through into the firstCaseheader, or past the block when it declares none.Simple = 0Falls through to the following offset. Every statement kind not covered by another member of this enum lowers as Simple.
With = 15A
Withblock'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.