View source code
Display the source code in dmd/statementsem.d from which this page was generated on github.
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 local clone.

Function dmd.statementsem.makeTupleForeach

Type check and unroll foreach over an expression tuple as well as static foreach statements and static foreach declarations. For static foreach statements and `static foreach` declarations, the visitor interface is used (and the result is written into the result field.) For `static foreach` declarations, the resulting Dsymbols* are returned directly.

dmd.statementsem.makeTupleForeach makeTupleForeach (
  dmd.dscope.Scope* sc,
  bool isStatic,
  bool isDecl,
  ForeachStatement fs,
  dmd.root.array.Array!(dmd.dsymbol.Dsymbol)* dbody,
  bool needExpansion
);

The unrolled body is wrapped into a - UnrolledLoopStatement, for foreach over an expression tuple. - ForwardingStatement, for static foreach statements. - ForwardingAttribDeclaration, for static foreach declarations.

static foreach variables are declared as STC.local, such that they are inserted into the local symbol tables of the forwarding constructs instead of forwarded. For `static foreach` with multiple foreach loop variables whose aggregate has been lowered into a sequence of tuples, this function expands the tuples into multiple STC.local static foreach variables.

Authors

Walter Bright

License

Boost License 1.0