diff dmd/TemplateDeclaration.d @ 49:0aa7d1437ada

AttribDeclaration.oneMember Lexer.decodeUTF WithStatement.ctor StructDeclaration.syntaxCopy CtorDeclaration.syntaxCopy ConditionalStatement.syntaxCopy ProtDeclaration.syntaxCopy ArrayScopeSymbol.this TemplateDeclaration.toChars
author korDen
date Sat, 21 Aug 2010 07:53:20 +0400
parents d42cd5917df4
children adf6f7f216ea
line wrap: on
line diff
--- a/dmd/TemplateDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/TemplateDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -309,7 +309,30 @@
 
     string toChars()
 	{
-		assert(false);
+		OutBuffer buf = new OutBuffer();
+		HdrGenState hgs;
+
+		/// memset(&hgs, 0, hgs.sizeof);
+		buf.writestring(ident.toChars());
+		buf.writeByte('(');
+		for (int i = 0; i < parameters.dim; i++)
+		{
+			TemplateParameter tp = cast(TemplateParameter)parameters.data[i];
+			if (i)
+				buf.writeByte(',');
+			tp.toCBuffer(buf, &hgs);
+		}
+		buf.writeByte(')');
+version (DMDV2) {
+		if (constraint)
+		{
+			buf.writestring(" if (");
+			constraint.toCBuffer(buf, &hgs);
+			buf.writeByte(')');
+		}
+}
+		buf.writeByte(0);
+		return buf.extractString();
 	}
 
     void emitComment(Scope sc)