diff dmd/SwitchErrorStatement.d @ 5:63623152e82a

Fixed memory corruption bug which was introduced when attempting to restore GC functionality
author dkoroskin <>
date Tue, 08 Dec 2009 21:39:17 +0300
parents 10317f0c89a5
children 2e2a5c3f943a
line wrap: on
line diff
--- a/dmd/SwitchErrorStatement.d	Mon Oct 26 16:28:19 2009 +0300
+++ b/dmd/SwitchErrorStatement.d	Tue Dec 08 21:39:17 2009 +0300
@@ -5,29 +5,46 @@
 import dmd.Loc;
 import dmd.IRState;
 import dmd.HdrGenState;
-import dmd.BE;
+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;
 
 class SwitchErrorStatement : Statement
 {
 	this(Loc loc)
 	{
-		assert(false);
 		super(loc);
 	}
 
 	BE blockExit()
 	{
-		assert(false);
+		return BE.BEthrow;
 	}
 
 	void toCBuffer(OutBuffer buf, HdrGenState* hgs)
 	{
-		assert(false);
+		buf.writestring("SwitchErrorStatement.toCBuffer()");
+		buf.writenl();
 	}
 
 	void toIR(IRState* irs)
 	{
-		assert(false);
+		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);
 	}
 }