diff dmd/ForeachStatement.d @ 130:60bb0fe4563e

dmdfe 2.037 first main iteration
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Thu, 09 Sep 2010 22:51:44 +0100
parents 1765f3ef917d
children af1bebfd96a4
line wrap: on
line diff
--- a/dmd/ForeachStatement.d	Sun Sep 05 15:32:22 2010 +0400
+++ b/dmd/ForeachStatement.d	Thu Sep 09 22:51:44 2010 +0100
@@ -64,7 +64,7 @@
 import dmd.AddAssignExp;
 import dmd.CmpExp;
 import dmd.Id;
-import dmd.Argument;
+import dmd.Parameter;
 import dmd.STC;
 
 import dmd.expression.Util;
@@ -74,7 +74,7 @@
 class ForeachStatement : Statement
 {
     TOK op;		// TOKforeach or TOKforeach_reverse
-    Arguments arguments;	// array of Argument*'s
+    Parameters arguments;	// array of Argument*'s
     Expression aggr;
     Statement body_;
 
@@ -86,7 +86,7 @@
     Array cases;	// put breaks, continues, gotos and returns here
     Array gotos;	// forward referenced goto's go here
 
-    this(Loc loc, TOK op, Arguments arguments, Expression aggr, Statement body_)
+    this(Loc loc, TOK op, Parameters arguments, Expression aggr, Statement body_)
 	{
 		super(loc);
 		
@@ -101,9 +101,9 @@
 	
     override Statement syntaxCopy()
 	{
-		Arguments args = Argument.arraySyntaxCopy(arguments);
+		auto args = Parameter.arraySyntaxCopy(arguments);
 		Expression exp = aggr.syntaxCopy();
-		ForeachStatement s = new ForeachStatement(loc, op, args, exp,
+		auto s = new ForeachStatement(loc, op, args, exp,
 		body_ ? body_.syntaxCopy() : null);
 		return s;
 	}
@@ -153,7 +153,7 @@
 				return s;
 			}
 
-			TypeTuple tuple = cast(TypeTuple)tab;
+			auto tuple = cast(TypeTuple)tab;
 			Statements statements = new Statements();
 			//printf("aggr: op = %d, %s\n", aggr.op, aggr.toChars());
 			size_t n;
@@ -165,7 +165,7 @@
 			}
 			else if (aggr.op == TOK.TOKtype)	// type tuple
 			{
-				n = Argument.dim(tuple.arguments);
+				n = Parameter.dim(tuple.arguments);
 			}
 			else
 				assert(0);
@@ -178,7 +178,7 @@
 				if (te)
 					e = te.exps[k];
 				else
-					t = Argument.getNth(tuple.arguments, k).type;
+					t = Parameter.getNth(tuple.arguments, k).type;
 
 				auto arg = arguments[0];
 				auto st = new Statements();
@@ -274,7 +274,7 @@
 				tn = tab.nextOf().toBasetype();
 				if (tn.ty == TY.Tchar || tn.ty == TY.Twchar || tn.ty == TY.Tdchar)
 				{	
-					Argument arg;
+					Parameter arg;
 
 					int i = (dim == 1) ? 0 : 1;	// index of value
 					arg = arguments[i];
@@ -532,11 +532,11 @@
 			Lapply:
 			{   
 				FuncDeclaration fdapply;
-				Arguments args;
+				Parameters args;
 				Expression ec;
 				Expression e;
 				FuncLiteralDeclaration fld;
-				Argument a;
+				Parameter a;
 				Type t;
 				Expression flde;
 				Identifier id;
@@ -553,7 +553,7 @@
 				// Need a variable to hold value from any return statements in body.
 				if (!sc.func.vresult && tret && tret != Type.tvoid)
 				{	
-					VarDeclaration v = new VarDeclaration(loc, tret, Id.result, null);
+					auto v = new VarDeclaration(loc, tret, Id.result, null);
 					v.noauto = true;
 					v.semantic(sc);
 					if (!sc.insert(v))
@@ -566,7 +566,7 @@
 				/* Turn body into the function literal:
 				 *	int delegate(ref T arg) { body }
 				 */
-				args = new Arguments();
+				args = new Parameters();
 				for (size_t i = 0; i < dim; i++)
 				{
 					auto arg = arguments[i];
@@ -587,7 +587,7 @@
 						s = new DeclarationStatement(Loc(0), v);
 						body_ = new CompoundStatement(loc, s, body_);
 					}
-					a = new Argument(STC.STCref, arg.type, id, null);
+					a = new Parameter(STC.STCref, arg.type, id, null);
 					args.push(a);
 				}
 				t = new TypeFunction(args, Type.tint32, 0, LINK.LINKd);
@@ -711,11 +711,9 @@
 						/* Call:
 						 *	aggr.apply!(fld)()
 						 */
-						TemplateInstance ti = new TemplateInstance(loc, idapply);
 						Objects tiargs = new Objects();
 						tiargs.push(cast(void*)fld);
-						ti.tiargs = tiargs;
-						ec = new DotTemplateInstanceExp(loc, aggr, ti);
+						ec = new DotTemplateInstanceExp(loc, aggr, idapply, tiargs);
 					}
 					else
 					{