diff dmd/TypeInfoTupleDeclaration.d @ 67:f708f0452e81

some of the backend/codegen stuff implemented
author korDen
date Mon, 23 Aug 2010 21:21:05 +0400
parents cab4c37afb89
children 2e2a5c3f943a
line wrap: on
line diff
--- a/dmd/TypeInfoTupleDeclaration.d	Mon Aug 23 20:38:30 2010 +0400
+++ b/dmd/TypeInfoTupleDeclaration.d	Mon Aug 23 21:21:05 2010 +0400
@@ -2,7 +2,16 @@
 
 import dmd.Type;
 import dmd.TypeInfoDeclaration;
+import dmd.WANT;
+import dmd.TypeTuple;
+import dmd.Argument;
+import dmd.Expression;
+import dmd.TY;
+import dmd.backend.TYM;
+import dmd.backend.Symbol;
 import dmd.backend.dt_t;
+import dmd.backend.Util;
+import dmd.codegen.Util;
 
 class TypeInfoTupleDeclaration : TypeInfoDeclaration
 {
@@ -13,6 +22,31 @@
 
     void toDt(dt_t **pdt)
 	{
-		assert(false);
+		//printf("TypeInfoTupleDeclaration.toDt() %s\n", tinfo.toChars());
+		dtxoff(pdt, Type.typeinfotypelist.toVtblSymbol(), 0, TYnptr); // vtbl for TypeInfoInterface
+		dtdword(pdt, 0);			    // monitor
+
+		assert(tinfo.ty == Ttuple);
+
+		TypeTuple tu = cast(TypeTuple)tinfo;
+
+		size_t dim = tu.arguments.dim;
+		dtdword(pdt, dim);			    // elements.length
+
+		dt_t* d = null;
+		for (size_t i = 0; i < dim; i++)
+		{	
+			Argument arg = cast(Argument)tu.arguments.data[i];
+			Expression e = arg.type.getTypeInfo(null);
+			e = e.optimize(WANTvalue);
+			e.toDt(&d);
+		}
+
+		Symbol *s;
+		s = static_sym();
+		s.Sdt = d;
+		outdata(s);
+
+		dtxoff(pdt, s, 0, TYnptr);		    // elements.ptr
 	}
 }
\ No newline at end of file