Statements make things happen.
They control the flow of execution, and can control lookup of
symbols in certain scopes. This is in contrast to expressions,
which compute values...and sometimes control flow. But the latter
is mostly the domain of statements, and allows Volt to be a
Turing complete language. Which is sometimes useful, we're told.
Condition |
Node represention a compile time conditional compilation. |
Statement |
Base class for all statements. |
BlockStatement |
A block statement is a group of zero or more statements. Why these
exist depends on where they live. |
ReturnStatement |
The return statement returns execution to the caller of the current
function, and optionally returns a value. |
AsmStatement |
The asm statement contains inline assembly. It's a list of tokens so
different backends can parse it however they want. It all still has to
lex as valid Volt, of course. |
AssertStatement |
The assert statement aborts if condition is flase, optionally
displaying message. isStatic determines whether condition is checked at
compile time or not. |
IfStatement |
If exp is true, execution flows to thenState. If exp is false,
execution flows to elseState, if it exists, otherwise it skips to the
end of the if statement. |
WhileStatement |
The while statement keeps executing the statements in block, as long as
condition evaluates in true. |
DoStatement |
Like a while statement, executes block while condition is true. Unlike
the while statement, at least one execution of block is guaranteed. |
ForStatement |
The for statement is a while statement that evaluates init first
(optionally introducing Variables into the for's scope), and running
increment at the end of each block's execution. Other than that, it
keeps executing block while test evaluates to true. |
ForeachStatement |
The foreach statement loops over elements in an aggregate. Arrays and
AAs have builtin support, but users can define iteration solutions for
their own types too. |
LabelStatement |
A label statement associates a string with a position in the statement
stream. Goto can then be used to jump to that position and anger
Dijkstra. |
ExpStatement |
An ExpStatement wraps an Expression in a Statement. |
SwitchStatement |
A switch statement jumps to various case labels depending on the value
of its condition. |
ContinueStatement |
The continue statement restarts a loop (while, dowhile, for, foreach). |
BreakStatement |
The break statement halts execution of a loop or a switch statement. |
GotoStatement |
The goto statement jumps to a label, or controls flow inside a switch
statement. |
WithStatement |
All lookups inside of a WithStatement first check exp before performing
a regular lookup. Ambiguities are still errors. |
SynchronizedStatement |
A synchronized statement ensures that only one thread of execution can
enter its block. An explicit mutex may be provided. |
TryStatement |
The try statement allows the resolution of throw statements, by
rerouting thrown exceptions into various catch blocks. |
ThrowStatement |
A throw statements halts the current functions execution and unwinds
the stack until it hits a try statement with an appropriate catch
statement or, failing that, it halts execution of the entire program. |
ScopeStatement |
ScopeStatements are executed on various conditions. Exits are always
executed when the given scope is left. Successes are executed when the
scope is left normally. Failures are executed when the scope is left by
way of an Exception. |
PragmaStatement |
Pragma statements do magical things. pragma(lib, "SDL"), for instance,
tells the compiler to link with SDL without the user having to specify
it on the command line. What pragmas are supported vary from compiler
to compiler, the only thing specified is that complying implementations
must die on unknown pragmas by default. |
ConditionStatement |
A ConditionStatement provides for conditional compilation of
statements. If condition is true, then it is as if block was where the
ConditionStatement was. Otherwise, the _else block replaces it (if
present). |
MixinStatement |
The mixin statement mixes in a mixin function, mixin template or a
string. |