view dmd/WhileStatement.d @ 62:6557375aff35

InExp.opId_r WhileStatement.syntaxCopy
author korDen
date Mon, 23 Aug 2010 03:21:32 +0400
parents 51605de93870
children cab4c37afb89
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);
	}
}