Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


Compiler implementation of the D programming language.

Source: statement.d

Identifier fixupLabelName(Scope* sc, Identifier ident);
CTFE requires FuncDeclaration::labtab for the interpretation. So fixing the label name inside in/out contracts is necessary for the uniqueness in labtab.
Scope* sc context
Identifier ident statement label name to be adjusted
adjusted label name
LabelStatement checkLabeledLoop(Scope* sc, Statement statement);
Check to see if statement is the innermost labeled statement.
Scope* sc context
Statement statement Statement to check
if true, then the LabelStatement, otherwise null
Expression checkAssignmentAsCondition(Expression e);
Check an assignment is used as a condition. Intended to be use before the semantic call on e.
Expression e condition expression which is not yet run semantic analysis.
e or ErrorExp.
TypeIdentifier getThrowable();
TypeIdentifier corresponding to object.Throwable
abstract class Statement: ddmd.root.rootobject.RootObject;


http: //

bool hasBreak();
Determine if an enclosed break would apply to this statement, such as if it is a loop or switch statement.
true if it does
bool hasContinue();
Determine if an enclosed continue would apply to this statement, such as if it is a loop statement.
true if it does
final bool usesEH();
true if statement uses exception handling
final bool comeFrom();
true if statement 'comes from' somewhere else, like a goto
final bool hasCode();
true if statement has executable code.
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.
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
code to be run in the finally clause
Statements* flatten(Scope* sc);
Flatten out the scope by presenting the statement as an array of statements.
Scope* sc context
The array of Statements, or null if no flattening necessary
inout pure nothrow inout(Statement) last();
Find last statement in a sequence of statements.
the last statement, or null if there isn't one
ErrorStatement isErrorStatement();

inout pure nothrow inout(ScopeStatement) isScopeStatement();

ExpStatement isExpStatement();

inout pure nothrow inout(CompoundStatement) isCompoundStatement();

inout pure nothrow inout(ReturnStatement) isReturnStatement();

IfStatement isIfStatement();

CaseStatement isCaseStatement();

DefaultStatement isDefaultStatement();

LabelStatement isLabelStatement();

pure GotoDefaultStatement isGotoDefaultStatement();

pure GotoCaseStatement isGotoCaseStatement();

inout pure nothrow inout(BreakStatement) isBreakStatement();

DtorExpStatement isDtorExpStatement();

ForwardingStatement isForwardingStatement();
A cheaper method of doing downcasting of Statements.
the downcast statement if it can be downcasted, otherwise null
void accept(Visitor v);
Support Visitor Pattern
Visitor v visitor
class ErrorStatement: ddmd.statement.Statement;
Any Statement that fails semantic() or has a component that is an ErrorExp or a TypeError should return an ErrorStatement from semantic().
class PeelStatement: ddmd.statement.Statement;
Statement toStatement(Dsymbol s);
Convert TemplateMixin members (== Dsymbols) to Statements.
class ExpStatement: ddmd.statement.Statement;
class DtorExpStatement: ddmd.statement.ExpStatement;
class CompileStatement: ddmd.statement.Statement;
class CompoundStatement: ddmd.statement.Statement;
final this(Loc loc, Statements* s);
Construct a CompoundStatement using an already existing array of Statements
Loc loc Instantiation information
Statements* s An array of Statements, that will referenced by this class
final this(Loc loc, Statement[] sts...);
Construct a CompoundStatement from an array of Statements
Loc loc Instantiation information
s A variadic array of Statements, that will copied in this class The entries themselves will not be copied.
class CompoundDeclarationStatement: ddmd.statement.CompoundStatement;
class UnrolledLoopStatement: ddmd.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.
class ScopeStatement: ddmd.statement.Statement;
class ForwardingStatement: ddmd.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.
Also see: ddmd.attrib.ForwardingAttribDeclaration
ForwardingScopeDsymbol sym;
The symbol containing the static foreach variables.
Statement statement;
The wrapped statement.
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`:
static foreach(i; 0 .. 10) scope(exit) writeln(i); writeln("this is printed first"); // then, it prints 10, 9, 8, 7, ...
class WhileStatement: ddmd.statement.Statement;
class DoStatement: ddmd.statement.Statement;
class ForStatement: ddmd.statement.Statement;
class ForeachStatement: ddmd.statement.Statement;
class ForeachRangeStatement: ddmd.statement.Statement;
class IfStatement: ddmd.statement.Statement;
class ConditionalStatement: ddmd.statement.Statement;
class StaticForeachStatement: ddmd.statement.Statement;
Static foreach statements, like: void main() { static foreach(i; 0 .. 10) { pragma(msg, i); } }
class PragmaStatement: ddmd.statement.Statement;
class StaticAssertStatement: ddmd.statement.Statement;
class SwitchStatement: ddmd.statement.Statement;
class CaseStatement: ddmd.statement.Statement;
class CaseRangeStatement: ddmd.statement.Statement;
class DefaultStatement: ddmd.statement.Statement;
class GotoDefaultStatement: ddmd.statement.Statement;
class GotoCaseStatement: ddmd.statement.Statement;
class SwitchErrorStatement: ddmd.statement.Statement;
class ReturnStatement: ddmd.statement.Statement;
class BreakStatement: ddmd.statement.Statement;
class ContinueStatement: ddmd.statement.Statement;
class SynchronizedStatement: ddmd.statement.Statement;
class WithStatement: ddmd.statement.Statement;
class TryCatchStatement: ddmd.statement.Statement;
class Catch: ddmd.root.rootobject.RootObject;
class TryFinallyStatement: ddmd.statement.Statement;
class OnScopeStatement: ddmd.statement.Statement;
class ThrowStatement: ddmd.statement.Statement;
class DebugStatement: ddmd.statement.Statement;
class GotoStatement: ddmd.statement.Statement;
class LabelStatement: ddmd.statement.Statement;
class LabelDsymbol: ddmd.dsymbol.Dsymbol;
class AsmStatement: ddmd.statement.Statement;
class CompoundAsmStatement: ddmd.statement.CompoundStatement;
a complete asm {} block
class ImportStatement: ddmd.statement.Statement;