Mercurial > projects > ddmd
view dmd/WhileStatement.d @ 63:cab4c37afb89
A bunch of implementations
author | korDen |
---|---|
date | Mon, 23 Aug 2010 16:52:24 +0400 |
parents | 6557375aff35 |
children | 2e2a5c3f943a |
line wrap: on
line source
module dmd.WhileStatement; import dmd.Statement; import dmd.Expression; import dmd.Scope; import dmd.InterState; import dmd.HdrGenState; import dmd.OutBuffer; import dmd.InlineScanState; import dmd.IRState; import dmd.Loc; import dmd.BE; import dmd.ForStatement; class WhileStatement : Statement { Expression condition; Statement body_; this(Loc loc, Expression c, Statement b) { super(loc); condition = c; body_ = b; } Statement syntaxCopy() { WhileStatement s = new WhileStatement(loc, condition.syntaxCopy(), body_ ? body_.syntaxCopy() : null); return s; } Statement semantic(Scope sc) { /* Rewrite as a for(;condition;) loop */ Statement s = new ForStatement(loc, null, condition, null, body_); s = s.semantic(sc); return s; } bool hasBreak() { return true; } bool hasContinue() { assert(false); } bool usesEH() { assert(false); } BE blockExit() { assert(false); } bool comeFrom() { assert(false); } Expression interpret(InterState istate) { assert(false); } void toCBuffer(OutBuffer buf, HdrGenState* hgs) { assert(false); } Statement inlineScan(InlineScanState* iss) { assert(false); } void toIR(IRState* irs) { assert(false); } }