dmd.statement
Defines AST nodes for statements.
Specification: Statements
License
Source: statement.d
Documentation: https://dlang.org/phobos/dmd_statement.html
-
Declaration
TypeIdentifier
getThrowable
();Return Value
TypeIdentifier
corresponding toobject.Throwable
-
Declaration
TypeIdentifier
getException
();Return Value
TypeIdentifier corresponding to
object.Exception
-
Declaration
enum
STMT
: ubyte;Identify Statement types with this enum rather than virtual functions.
-
Declaration
abstract class
Statement
: dmd.ast_node.ASTNode;Specification: http://dlang.org/spec/statement.html
-
Declaration
static Statements*
arraySyntaxCopy
(Statements*a
);Do syntax copy of an array of Statement's.
-
Declaration
const pure nothrow bool
hasBreak
();Determine if an enclosed
break
would apply to this statement, such as if it is a loop or switch statement.Return Value
true
if it does -
Declaration
const pure nothrow bool
hasContinue
();Determine if an enclosed
continue
would apply to this statement, such as if it is a loop statement.Return Value
true
if it does -
Declaration
final bool
usesEH
();Return Value
true
if statement uses exception handling -
Declaration
final bool
comeFrom
();Return Value
true
if statement 'comes from' somewhere else, like a goto -
Declaration
final bool
hasCode
();Return Value
true
if statement has executable code. -
Declaration
Statement
scopeCode
(Scope*sc
, Statement*sentry
, Statement*sexception
, Statement*sfinally
);If this statement has code that needs to run in a finally clause at the end of the current scope, return that code in the form of a Statement.
Parameters
Scope*
sc
context
Statement*
sentry
set to code executed upon entry to the scope
Statement*
sexception
set to code executed upon exit from the scope via exception
Statement*
sfinally
set to code executed in finally block
Return Value
code to be run in the finally clause
-
Declaration
Statements*
flatten
(Scope*sc
);Flatten out the scope by presenting the statement as an array of statements.
Parameters
Scope*
sc
context
Return Value
The array of
Statements
, ornull
if no flattening necessary -
Declaration
inout pure nothrow inout(Statement)
last
();Find
last
statement in a sequence of statements.Return Value
the
last
statement, ornull
if there isn't one -
Declaration
void
accept
(Visitorv
);Support Visitor Pattern
Parameters
Visitor
v
visitor
-
Declaration
inout pure nothrow @nogc inout(ReturnStatement)
endsWithReturnStatement
();Does this statement end with a return statement?
Discussion
I.e. is it a single return statement or some compound statement that unconditionally hits a return statement.
Return Value
return statement it ends with, otherwise
null
-
Declaration
final inout pure nothrow @nogc inout(ErrorStatement)
isErrorStatement
();A cheaper method of doing downcasting of Statements.
Return Value
the downcast statement if it can be downcasted, otherwise
null
-
-
Declaration
class
ErrorStatement
: dmd.statement.Statement;Any Statement that fails semantic() or has a component that is an ErrorExp or a TypeError should return an
ErrorStatement
from semantic(). -
Declaration
class
PeelStatement
: dmd.statement.Statement; -
Declaration
class
ExpStatement
: dmd.statement.Statement; -
Declaration
class
DtorExpStatement
: dmd.statement.ExpStatement; -
Declaration
class
CompileStatement
: dmd.statement.Statement; -
Declaration
class
CompoundStatement
: dmd.statement.Statement;-
Declaration
final this(ref const Loc
loc
, Statements*statements
);Construct a
CompoundStatement
using an already existing array ofStatement
sParameters
Loc
loc
Instantiation information
Statements*
statements
An array of
Statement
s, that will referenced by this class -
Declaration
final this(ref const Loc
loc
, Statement[]sts
...);Construct a
CompoundStatement
from an array ofStatement
sParameters
Loc
loc
Instantiation information
Statement[]
sts
A variadic array of
Statement
s, that will copied in this class The entries themselves will not be copied.
-
-
Declaration
class
CompoundDeclarationStatement
: dmd.statement.CompoundStatement; -
Declaration
class
UnrolledLoopStatement
: dmd.statement.Statement;The purpose of this is so that continue will go to the next of the statements, and break will go to the end of the statements.
-
Declaration
class
ScopeStatement
: dmd.statement.Statement; -
Declaration
class
ForwardingStatement
: dmd.statement.Statement;Statement whose symbol table contains foreach index variables in a local scope and forwards other members to the parent scope. This wraps a statement.
Discussion
Also see:
dmd.attrib.ForwardingAttribDeclaration
-
Declaration
ForwardingScopeDsymbol
sym
;The symbol containing the
static foreach
variables. -
Declaration
Statement
statement
;The wrapped
statement
. -
Declaration
Statements*
flatten
(Scope*sc
);ForwardingStatements are distributed over the flattened sequence of statements. This prevents flattening to be "blocked" by a ForwardingStatement and is necessary, for example, to support generating scope guards with `static foreach`:
Discussion
static foreach(i; 0 .. 10) scope(exit) writeln(i); writeln("this is printed first"); // then, it prints 10, 9, 8, 7, ...
-
-
Declaration
class
WhileStatement
: dmd.statement.Statement; -
Declaration
class
DoStatement
: dmd.statement.Statement; -
Declaration
class
ForStatement
: dmd.statement.Statement; -
Declaration
class
ForeachStatement
: dmd.statement.Statement; -
Declaration
class
ForeachRangeStatement
: dmd.statement.Statement; -
Declaration
class
IfStatement
: dmd.statement.Statement; -
Declaration
class
ConditionalStatement
: dmd.statement.Statement; -
Declaration
class
StaticForeachStatement
: dmd.statement.Statement;https://dlang.org/spec/version.html#StaticForeachStatement Static foreach statements, like: void main() { static foreach(i; 0 .. 10) { pragma(msg, i); } }
-
Declaration
class
PragmaStatement
: dmd.statement.Statement; -
Declaration
class
StaticAssertStatement
: dmd.statement.Statement; -
Declaration
class
SwitchStatement
: dmd.statement.Statement;-
Declaration
Expression
condition
;switch(
condition
) -
Declaration
Statement
_body
; -
Declaration
bool
isFinal
; -
Declaration
DefaultStatement
sdefault
;default:
-
Declaration
Statement
tryBody
;set to TryCatchStatement or TryFinallyStatement if in body portion
-
Declaration
TryFinallyStatement
tf
;set if in the 'finally' block of a TryFinallyStatement
-
Declaration
GotoCaseStatements
gotoCases
;array of unresolved GotoCaseStatement's
-
Declaration
CaseStatements*
cases
;array of CaseStatement's
-
Declaration
int
hasNoDefault
;!=0 if no default statement
-
Declaration
int
hasVars
;!=0 if has variable case values
-
Declaration
VarDeclaration
lastVar
;last observed variable declaration in this statement
-
Declaration
bool
checkLabel
();Return Value
true
if error
-
-
Declaration
class
CaseStatement
: dmd.statement.Statement; -
Declaration
class
CaseRangeStatement
: dmd.statement.Statement; -
Declaration
class
DefaultStatement
: dmd.statement.Statement; -
Declaration
class
GotoDefaultStatement
: dmd.statement.Statement; -
Declaration
class
GotoCaseStatement
: dmd.statement.Statement; -
Declaration
class
SwitchErrorStatement
: dmd.statement.Statement; -
Declaration
class
ReturnStatement
: dmd.statement.Statement; -
Declaration
class
BreakStatement
: dmd.statement.Statement; -
Declaration
class
ContinueStatement
: dmd.statement.Statement; -
Declaration
class
SynchronizedStatement
: dmd.statement.Statement; -
Declaration
class
WithStatement
: dmd.statement.Statement; -
Declaration
class
TryCatchStatement
: dmd.statement.Statement;-
Declaration
Statement
tryBody
;set to enclosing TryCatchStatement or TryFinallyStatement if in body portion
-
-
Declaration
class
Catch
: dmd.root.rootobject.RootObject; -
Declaration
class
TryFinallyStatement
: dmd.statement.Statement;-
Declaration
Statement
tryBody
;set to enclosing TryCatchStatement or TryFinallyStatement if in body portion
-
Declaration
bool
bodyFallsThru
;true
if body falls through to finally
-
-
Declaration
class
ScopeGuardStatement
: dmd.statement.Statement; -
Declaration
class
ThrowStatement
: dmd.statement.Statement; -
Declaration
class
DebugStatement
: dmd.statement.Statement; -
Declaration
class
GotoStatement
: dmd.statement.Statement;-
Declaration
Statement
tryBody
;set to TryCatchStatement or TryFinallyStatement if in body portion
-
-
Declaration
class
LabelStatement
: dmd.statement.Statement;-
Declaration
Statement
tryBody
;set to TryCatchStatement or TryFinallyStatement if in body portion
-
-
Declaration
class
LabelDsymbol
: dmd.dsymbol.Dsymbol; -
Declaration
class
AsmStatement
: dmd.statement.Statement; -
Declaration
class
InlineAsmStatement
: dmd.statement.AsmStatement; -
Declaration
class
GccAsmStatement
: dmd.statement.AsmStatement;https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html Assembler instructions with D expression operands.
-
Declaration
class
CompoundAsmStatement
: dmd.statement.CompoundStatement;a complete asm {} block
-
Declaration
class
ImportStatement
: dmd.statement.Statement;