view dmd/GotoDefaultStatement.d @ 64:4290d870944a

More fixes
author korDen
date Mon, 23 Aug 2010 20:29:15 +0400
parents cab4c37afb89
children ee3a9f34dc48
line wrap: on
line source

module dmd.GotoDefaultStatement;

import dmd.Statement;
import dmd.SwitchStatement;
import dmd.Loc;
import dmd.Scope;
import dmd.Expression;
import dmd.InterState;
import dmd.OutBuffer;
import dmd.HdrGenState;
import dmd.IRState;
import dmd.BE;

class GotoDefaultStatement : Statement
{
    SwitchStatement sw;

    this(Loc loc)
	{
		super(loc);
		sw = null;
	}

    Statement syntaxCopy()
	{
		GotoDefaultStatement s = new GotoDefaultStatement(loc);
		return s;
	}

    Statement semantic(Scope sc)
	{
		sw = sc.sw;
		if (!sw)
			error("goto default not in switch statement");
		return this;
	}

    Expression interpret(InterState istate)
	{
		assert(false);
	}

    BE blockExit()
	{
		return BEgoto;
	}

    void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		buf.writestring("goto default;\n");
	}

    void toIR(IRState *irs)
	{
		assert(false);
	}
}