view dmd/ConditionalStatement.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children 0aa7d1437ada
line wrap: on
line source

module dmd.ConditionalStatement;

import dmd.Statement;
import dmd.Condition;
import dmd.Loc;
import dmd.OutBuffer;
import dmd.Scope;
import dmd.HdrGenState;
import dmd.ArrayTypes;
import dmd.BE;

class ConditionalStatement : Statement
{
    Condition condition;
    Statement ifbody;
    Statement elsebody;

    this(Loc loc, Condition condition, Statement ifbody, Statement elsebody)
	{
		super(loc);
		this.condition = condition;
		this.ifbody = ifbody;
		this.elsebody = elsebody;
	}
	
    Statement syntaxCopy()
	{
		assert(false);
	}
	
    Statement semantic(Scope sc)
	{
		assert(false);
	}
	
    Statements flatten(Scope sc)
	{
		Statement s;

		if (condition.include(sc, null))
			s = ifbody;
		else
			s = elsebody;

		Statements a = new Statements();
		a.push(cast(void*)s);

		return a;
	}
	
    bool usesEH()
	{
		assert(false);
	}
	
    BE blockExit()
	{
		assert(false);
	}

    void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		assert(false);
	}
}