Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
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.

# dmd.statement

Compiler implementation of the D programming language.
Authors:
Walter Bright
License:
Boost License 1.0

Source statement.d

Documentation https://dlang.org/phobos/dmd_statement.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/statement.d

TypeIdentifier `getThrowable`();
  Returns:
  TypeIdentifier corresponding to object.Throwable
TypeIdentifier `getException`();
  Returns:
  TypeIdentifier corresponding to object.Exception
abstract class `Statement`: dmd.ast_node.ASTNode;

  Specification http://dlang.org/spec/statement.html

  static Statements* `arraySyntaxCopy`(Statements* `a`);
    Do syntax copy of an array of Statement's.
  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.
    Returns:
    true if it does
  const pure nothrow bool `hasContinue`();
    Determine if an enclosed continue would apply to this statement, such as if it is a loop statement.
    Returns:
    true if it does
  final bool `usesEH`();
    Returns:
    true if statement uses exception handling
  final bool `comeFrom`();
    Returns:
    true if statement 'comes from' somewhere else, like a goto
  final bool `hasCode`();
    Returns:
    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.
    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

    Returns:
    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.
    Parameters:

    Scope* `sc` | context

    Returns:
    The array of Statements, or null if no flattening necessary
  inout pure nothrow inout(Statement) `last`();
    Find last statement in a sequence of statements.
    Returns:
    the last statement, or null if there isn't one
  void `accept`(Visitor `v`);
    Support Visitor Pattern
    Parameters:

    Visitor `v` | visitor

  inout pure nothrow @nogc inout(ErrorStatement) `isErrorStatement`();
    A cheaper method of doing downcasting of Statements.
    Returns:
    the downcast statement if it can be downcasted, otherwise null
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().
class `PeelStatement`: dmd.statement.Statement;
class `ExpStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#ExpressionStatement
class `DtorExpStatement`: dmd.statement.ExpStatement;
class `CompileStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#mixin-statement
class `CompoundStatement`: dmd.statement.Statement;
  final this(ref const Loc `loc`, Statements* `statements`);
    Construct a CompoundStatement using an already existing array of Statements
    Parameters:

    Loc `loc` | Instantiation information
    Statements* `statements` | An array of Statements, that will referenced by this class

  final this(ref const Loc `loc`, Statement[] `sts`...);
    Construct a CompoundStatement from an array of Statements
    Parameters:

    Loc `loc` | Instantiation information
    Statement[] `sts` | A variadic array of Statements, that will copied in this class The entries themselves will not be copied.

class `CompoundDeclarationStatement`: dmd.statement.CompoundStatement;
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.
class `ScopeStatement`: dmd.statement.Statement;
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.
  Also see: dmd.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`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#while-statement
class `DoStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#do-statement
class `ForStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#for-statement
class `ForeachStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#foreach-statement
class `ForeachRangeStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#foreach-range-statement
class `IfStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#if-statement
class `ConditionalStatement`: dmd.statement.Statement;
  https://dlang.org/spec/version.html#ConditionalStatement
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); } }
class `PragmaStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#pragma-statement
class `StaticAssertStatement`: dmd.statement.Statement;
  https://dlang.org/spec/version.html#StaticAssert
class `SwitchStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#switch-statement
  Expression `condition`;
    switch(condition)
  Statement `_body`;
  bool `isFinal`;
    https://dlang.org/spec/statement.html#final-switch-statement
  DefaultStatement `sdefault`;
    default:
  TryFinallyStatement `tf`;
  GotoCaseStatements `gotoCases`;
    array of unresolved GotoCaseStatement's
  CaseStatements* `cases`;
    array of CaseStatement's
  int `hasNoDefault`;
    !=0 if no default statement
  int `hasVars`;
    !=0 if has variable case values
  VarDeclaration `lastVar`;
    last observed variable declaration in this statement
  bool `checkLabel`();
    Returns:
    true if error
class `CaseStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#CaseStatement
class `CaseRangeStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#CaseRangeStatement
class `DefaultStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#DefaultStatement
class `GotoDefaultStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#GotoStatement
class `GotoCaseStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#GotoStatement
class `SwitchErrorStatement`: dmd.statement.Statement;
class `ReturnStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#return-statement
class `BreakStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#break-statement
class `ContinueStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#continue-statement
class `SynchronizedStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#SynchronizedStatement
class `WithStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#with-statement
class `TryCatchStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#try-statement
class `Catch`: dmd.root.rootobject.RootObject;
  https://dlang.org/spec/statement.html#Catch
class `TryFinallyStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#try-statement
class `ScopeGuardStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#scope-guard-statement
class `ThrowStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#throw-statement
class `DebugStatement`: dmd.statement.Statement;
class `GotoStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#goto-statement
class `LabelStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#LabeledStatement
class `LabelDsymbol`: dmd.dsymbol.Dsymbol;
class `AsmStatement`: dmd.statement.Statement;
  https://dlang.org/spec/statement.html#asm
class `InlineAsmStatement`: dmd.statement.AsmStatement;
  https://dlang.org/spec/iasm.html
class `GccAsmStatement`: dmd.statement.AsmStatement;
  https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html Assembler instructions with D expression operands.
class `CompoundAsmStatement`: dmd.statement.CompoundStatement;
  a complete asm {} block
class `ImportStatement`: dmd.statement.Statement;
  https://dlang.org/spec/module.html#ImportDeclaration

Copyright © 1999-2019 by the D Language Foundation | Page generated by Ddoc on Tue Jul 2 10:02:11 2019