diff dmd/AsmStatement.d @ 174:af724d3510d7

lot os toCBuffer methods implemented moved shared Type.* stuff into Global
author korDen
date Sun, 10 Oct 2010 03:47:23 +0400
parents 60bb0fe4563e
children fa9a71a9f5a8
line wrap: on
line diff
--- a/dmd/AsmStatement.d	Sun Oct 10 01:55:35 2010 +0400
+++ b/dmd/AsmStatement.d	Sun Oct 10 03:47:23 2010 +0400
@@ -36,6 +36,8 @@
 import core.stdc.string : memset;
 import core.stdc.stdlib : exit, EXIT_FAILURE;
 
+import std.stdio;
+
 class AsmStatement : Statement
 {
     Token* tokens;
@@ -276,7 +278,30 @@
 
     override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
 	{
-		assert(false);
+		buf.writestring("asm { ");
+		Token* t = tokens;
+		while (t)
+		{
+			buf.writestring(t.toChars());
+			if (t.next                         &&
+			   t.value != TOKmin               &&
+			   t.value != TOKcomma             &&
+			   t.next.value != TOKcomma       &&
+			   t.value != TOKlbracket          &&
+			   t.next.value != TOKlbracket    &&
+			   t.next.value != TOKrbracket    &&
+			   t.value != TOKlparen            &&
+			   t.next.value != TOKlparen      &&
+			   t.next.value != TOKrparen      &&
+			   t.value != TOKdot               &&
+			   t.next.value != TOKdot)
+			{
+				buf.writebyte(' ');
+			}
+			t = t.next;
+		}
+		buf.writestring("; }");
+		buf.writenl();
 	}
 	
     override AsmStatement isAsmStatement() { return this; }
@@ -298,6 +323,7 @@
 		list_append(&bpre.Bsucc, basm);
 		basm.Bcode = asmcode;
 		basm.Balign = cast(ubyte)asmalign;
+
 static if (false) {
 		if (label)
 		{	
@@ -312,7 +338,7 @@
 		{	
 			LabelDsymbol label;
 			block* b;
-
+			
 			switch (c.IFL1)
 			{
 				case FLblockoff: