view dmd/SwitchErrorStatement.d @ 191:52188e7e3fb5

Fixed deprecated features, now compiles with DMD2.058 Also changed Array allocation policy: Now doesn't reallocate but malloc's, followed by a memcpy (no free). (this fixes a crash while compiling druntime. Same bug in dmd)
author korDen@korDen-pc
date Sun, 25 Mar 2012 03:11:12 +0400
parents b0d41ff5e0df
children
line wrap: on
line source

module dmd.SwitchErrorStatement;

import dmd.common;
import dmd.Statement;
import dmd.OutBuffer;
import dmd.Loc;
import dmd.IRState;
import dmd.HdrGenState;
import dmd.BE;

import dmd.backend.elem;
import dmd.backend.Blockx;
import dmd.backend.Util;
import dmd.backend.TYM;
import dmd.backend.OPER;
import dmd.backend.RTLSYM;

import dmd.DDMDExtensions;

class SwitchErrorStatement : Statement
{
	mixin insertMemberExtension!(typeof(this));

	this(Loc loc)
	{
		register();
		super(loc);
	}

	override BE blockExit()
	{
		return BE.BEthrow;
	}

	override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		buf.writestring("SwitchErrorStatement.toCBuffer()");
		buf.writenl();
	}

	override void toIR(IRState* irs)
	{
		elem* e;
		elem* elinnum;
		elem* efilename;
		Blockx* blx = irs.blx;

		//printf("SwitchErrorStatement.toIR()\n");

		efilename = blx.module_.toEmodulename();
		elinnum = el_long(TYM.TYint, loc.linnum);
		e = el_bin(OPER.OPcall, TYM.TYvoid, el_var(rtlsym[RTLSYM_DSWITCHERR]), el_param(elinnum, efilename));
		block_appendexp(blx.curblock, e);
	}
}