diff dmd/Argument.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents 5c9b78899f5d
children e28b18c23469
line wrap: on
line diff
--- a/dmd/Argument.d	Sat Aug 21 13:28:16 2010 +0400
+++ b/dmd/Argument.d	Sat Aug 21 14:16:53 2010 +0400
@@ -2,6 +2,9 @@
 
 import dmd.Type;
 import dmd.Identifier;
+import dmd.TypeArray;
+import dmd.TypeFunction;
+import dmd.TypeDelegate;
 import dmd.TypeTuple;
 import dmd.TY;
 import dmd.Expression;
@@ -40,9 +43,32 @@
 		return new Argument(storageClass, type ? type.syntaxCopy() : null, ident, defaultArg ? defaultArg.syntaxCopy() : null);
 	}
 	
+	/****************************************************
+	 * Determine if parameter is a lazy array of delegates.
+	 * If so, return the return type of those delegates.
+	 * If not, return null.
+	 */
     Type isLazyArray()
 	{
-		assert(false);
+	//    if (inout == Lazy)
+		{
+			Type tb = type.toBasetype();
+			if (tb.ty == Tsarray || tb.ty == Tarray)
+			{
+				Type tel = (cast(TypeArray)tb).next.toBasetype();
+				if (tel.ty == Tdelegate)
+				{
+					TypeDelegate td = cast(TypeDelegate)tel;
+					TypeFunction tf = cast(TypeFunction)td.next;
+
+					if (!tf.varargs && Argument.dim(tf.parameters) == 0)
+					{
+						return tf.next;	// return type of delegate
+					}
+				}
+			}
+		}
+		return null;
 	}
 	
     void toDecoBuffer(OutBuffer buf)