changeset 126:1765f3ef917d

ClassDeclarations, Arguments -> Vector
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Fri, 03 Sep 2010 23:25:55 +0100
parents 767a01c2a272
children 9ee9b55452cb
files dmd/Argument.d dmd/ArrayTypes.d dmd/AssignExp.d dmd/BinExp.d dmd/ClassDeclaration.d dmd/Expression.d dmd/ForeachStatement.d dmd/FuncDeclaration.d dmd/IsExp.d dmd/Module.d dmd/Parser.d dmd/SliceExp.d dmd/StructDeclaration.d dmd/TemplateDeclaration.d dmd/TemplateInstance.d dmd/TupleDeclaration.d dmd/TypeFunction.d dmd/TypeInfoStructDeclaration.d dmd/TypeInfoTupleDeclaration.d dmd/TypeSArray.d dmd/TypeSlice.d dmd/TypeTuple.d dmd/expression/Util.d
diffstat 23 files changed, 107 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/Argument.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/Argument.d	Fri Sep 03 23:25:55 2010 +0100
@@ -104,7 +104,7 @@
 	
     static Arguments arraySyntaxCopy(Arguments args)
 	{
-		Arguments a = null;
+		typeof(return) a = null;
 
 		if (args)
 		{
@@ -113,10 +113,10 @@
 
 			for (size_t i = 0; i < a.dim; i++)
 			{   
-				Argument arg = cast(Argument)args.data[i];
+				auto arg = args[i];
 
 				arg = arg.syntaxCopy();
-				a.data[i] = cast(void*)arg;
+				a[i] = arg;
 			}
 		}
 	
@@ -175,7 +175,7 @@
 			{
 				if (i)
 					buf.writestring(", ");
-				Argument arg = cast(Argument)arguments.data[i];
+				auto arg = arguments[i];
 
 				if (arg.storageClass & STCout)
 					buf.writestring("out ");
@@ -250,14 +250,13 @@
 		size_t n = 0;
 		if (args)
 		{
-			for (size_t i = 0; i < args.dim; i++)
+			foreach (arg; args)
 			{   
-				Argument arg = cast(Argument)args.data[i];
 				Type t = arg.type.toBasetype();
 
 				if (t.ty == TY.Ttuple)
 				{   
-					TypeTuple tu = cast(TypeTuple)t;
+					auto tu = cast(TypeTuple)t;
 					n += dim(tu.arguments);
 				}
 				else
@@ -280,9 +279,8 @@
 			return null;
 
 		size_t n = 0;
-		for (size_t i = 0; i < args.dim; i++)
+		foreach (arg; args)
 		{   
-			Argument arg = cast(Argument)args.data[i];
 			Type t = arg.type.toBasetype();
 
 			if (t.ty == TY.Ttuple)
--- a/dmd/ArrayTypes.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/ArrayTypes.d	Fri Sep 03 23:25:55 2010 +0100
@@ -5,15 +5,15 @@
 import dmd.TemplateParameter;
 import dmd.Statement;
 import dmd.BaseClass;
+import dmd.ClassDeclaration;
+import dmd.Argument;
 
 alias Vector!Object Objects;
 alias Vector!TemplateParameter TemplateParameters;
 alias Vector!Statement Statements;
 alias Vector!BaseClass BaseClasses;
-
-class ClassDeclarations : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
-
-class Arguments : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
+alias Vector!ClassDeclaration ClassDeclarations;
+alias Vector!Argument Arguments;
 
 class Identifiers : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
--- a/dmd/AssignExp.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/AssignExp.d	Fri Sep 03 23:25:55 2010 +0100
@@ -404,7 +404,7 @@
 		ex2 = new CastExp(Loc(0), ex2, e1.type.nextOf());
 	}
 		Expression ex1 = e1.buildArrayLoop(fparams);
-		Argument param = cast(Argument)fparams.data[0];
+		auto param = fparams[0];
 		param.storageClass = STCundefined;
 		Expression e = new AssignExp(Loc(0), ex1, ex2);
 		return e;
--- a/dmd/BinExp.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/BinExp.d	Fri Sep 03 23:25:55 2010 +0100
@@ -1659,7 +1659,7 @@
 
 				Arguments fparams = new Arguments();
 				Expression loopbody = buildArrayLoop(fparams);
-				Argument p = cast(Argument)fparams.data[0 /*fparams.dim - 1*/];
+				auto p = fparams[0 /*fparams.dim - 1*/];
 version (DMDV1) {
 				// for (size_t i = 0; i < p.length; i++)
 				Initializer init = new ExpInitializer(0, new IntegerExp(0, 0, Type.tsize_t));
@@ -2036,7 +2036,7 @@
 		 */
 		Expression ex2 = e2.buildArrayLoop(fparams);
 		Expression ex1 = e1.buildArrayLoop(fparams);
-		Argument param = cast(Argument)fparams.data[0];
+		auto param = fparams[0];
 		param.storageClass = STCundefined;
 		Expression e = new AssignExpType(Loc(0), ex1, ex2);
 		return e;
--- a/dmd/ClassDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/ClassDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -1159,7 +1159,7 @@
 
     override void addLocalClass(ClassDeclarations aclasses)
 	{
-		aclasses.push(cast(void*)this);
+		aclasses.push(this);
 	}
 
     // Back end
--- a/dmd/Expression.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/Expression.d	Fri Sep 03 23:25:55 2010 +0100
@@ -990,8 +990,8 @@
     Expression buildArrayLoop(Arguments fparams)
 	{
 		Identifier id = Identifier.generateId("c", fparams.dim);
-		Argument param = new Argument(STC.STCundefined, type, id, null);
-		fparams.shift(cast(void*)param);
+		auto param = new Argument(STC.STCundefined, type, id, null);
+		fparams.shift(param);
 		Expression e = new IdentifierExp(Loc(0), id);
 		return e;
 	}
--- a/dmd/ForeachStatement.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/ForeachStatement.d	Fri Sep 03 23:25:55 2010 +0100
@@ -180,8 +180,8 @@
 				else
 					t = Argument.getNth(tuple.arguments, k).type;
 
-				Argument arg = cast(Argument)arguments.data[0];
-				Statements st = new Statements();
+				auto arg = arguments[0];
+				auto st = new Statements();
 
 				if (dim == 2)
 				{   
@@ -204,7 +204,7 @@
 					var.storage_class |= STC.STCmanifest;
 					DeclarationExp de = new DeclarationExp(loc, var);
 					st.push(new ExpStatement(loc, de));
-					arg = cast(Argument)arguments.data[1];	// value
+					arg = arguments[1];	// value
 				}
 				// Declare value
 				if (arg.storageClass & (STC.STCout | STC.STCref | STC.STClazy))
@@ -215,7 +215,7 @@
 					Type tb = e.type.toBasetype();
 					if ((tb.ty == TY.Tfunction || tb.ty == TY.Tsarray) && e.op == TOK.TOKvar)
 					{   
-						VarExp ve = cast(VarExp)e;
+						auto ve = cast(VarExp)e;
 						var = new AliasDeclaration(loc, arg.ident, ve.var);
 					}
 					else
@@ -277,7 +277,7 @@
 					Argument arg;
 
 					int i = (dim == 1) ? 0 : 1;	// index of value
-					arg = cast(Argument)arguments.data[i];
+					arg = arguments[i];
 					arg.type = arg.type.semantic(loc, sc);
 					tnv = arg.type.toBasetype();
 					if (tnv.ty != tn.ty && (tnv.ty == TY.Tchar || tnv.ty == TY.Twchar || tnv.ty == TY.Tdchar))
@@ -286,7 +286,7 @@
 							error("foreach: value of UTF conversion cannot be ref");
 						if (dim == 2)
 						{	
-							arg = cast(Argument)arguments.data[0];
+							arg = arguments[0];
 							if (arg.storageClass & STC.STCref)
 								error("foreach: key cannot be ref");
 						}
@@ -297,9 +297,9 @@
 				for (size_t i = 0; i < dim; i++)
 				{	
 					// Declare args
-					Argument arg = cast(Argument)arguments.data[i];
+					auto arg = arguments[i];
 					Type argtype = arg.type.semantic(loc, sc);
-					VarDeclaration var = new VarDeclaration(loc, argtype, arg.ident, null);
+					auto var = new VarDeclaration(loc, argtype, arg.ident, null);
 					var.storage_class |= STC.STCforeach;
 					var.storage_class |= arg.storageClass & (STC.STCin | STC.STCout | STC.STCref | STC.STC_TYPECTOR);
 					if (var.storage_class & (STC.STCref | STC.STCout))
@@ -508,12 +508,12 @@
 				e = new VarExp(loc, r);
 				Expression einit = new DotIdExp(loc, e, idhead);
 		//	    einit = einit.semantic(sc);
-				Argument arg = cast(Argument)arguments.data[0];
-				VarDeclaration ve = new VarDeclaration(loc, arg.type, arg.ident, new ExpInitializer(loc, einit));
+				auto arg = arguments[0];
+				auto ve = new VarDeclaration(loc, arg.type, arg.ident, new ExpInitializer(loc, einit));
 				ve.storage_class |= STC.STCforeach;
 				ve.storage_class |= arg.storageClass & (STC.STCin | STC.STCout | STC.STCref | STC.STC_TYPECTOR);
 
-				DeclarationExp de = new DeclarationExp(loc, ve);
+				auto de = new DeclarationExp(loc, ve);
 
 				Statement body2 = new CompoundStatement(loc, new DeclarationStatement(loc, de), this.body_);
 				s = new ForStatement(loc, init, condition, increment, body2);
@@ -569,7 +569,7 @@
 				args = new Arguments();
 				for (size_t i = 0; i < dim; i++)
 				{
-					Argument arg = cast(Argument)arguments.data[i];
+					auto arg = arguments[i];
 
 					arg.type = arg.type.semantic(loc, sc);
 					if (arg.storageClass & STC.STCref)
@@ -588,7 +588,7 @@
 						body_ = new CompoundStatement(loc, s, body_);
 					}
 					a = new Argument(STC.STCref, arg.type, id, null);
-					args.push(cast(void*)a);
+					args.push(a);
 				}
 				t = new TypeFunction(args, Type.tint32, 0, LINK.LINKd);
 				fld = new FuncLiteralDeclaration(loc, Loc(0), t, TOK.TOKdelegate, this);
@@ -615,7 +615,7 @@
 				if (tab.ty == TY.Taarray)
 				{
 					// Check types
-					Argument arg = cast(Argument)arguments.data[0];
+					auto arg = arguments[0];
 					if (dim == 2)
 					{
 						if (arg.storageClass & STC.STCref)
@@ -623,7 +623,7 @@
 						if (!arg.type.equals(taa.index))
 							error("foreach: index must be type %s, not %s", taa.index.toChars(), arg.type.toChars());
 
-						arg = cast(Argument)arguments.data[1];
+						arg = arguments[1];
 					}
 					if (!arg.type.equals(taa.nextOf()))
 						error("foreach: value must be type %s, not %s", taa.nextOf().toChars(), arg.type.toChars());
@@ -781,9 +781,8 @@
 	{
 		bool result = true;
 
-		for (size_t i = 0; i < arguments.dim; i++)
+		foreach (arg; arguments)
 		{	
-			Argument arg = cast(Argument)arguments.data[i];
 			if (!arg.type)
 			{
 				error("cannot infer type for %s", arg.ident.toChars());
@@ -842,7 +841,7 @@
 		buf.writestring(" (");
 		for (int i = 0; i < arguments.dim; i++)
 		{
-			Argument a = cast(Argument)arguments.data[i];
+			auto a = arguments[i];
 			if (i)
 				buf.writestring(", ");
 			if (a.storageClass & STCref) 
--- a/dmd/FuncDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/FuncDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -822,7 +822,7 @@
 				if (outId)
 				{	
 					a = new Argument(STCref, f.nextOf(), outId, null);
-					arguments.push(cast(void*)a);
+					arguments.push(a);
 				}
 				TypeFunction tf = new TypeFunction(arguments, Type.tvoid, 0, LINKd);
 				FuncDeclaration fd = new FuncDeclaration(loc, loc, Id.ensure, STCundefined, tf);
@@ -1055,12 +1055,11 @@
 		// Propagate storage class from tuple parameters to their element-parameters.
 		if (f.parameters)
 		{
-			for (size_t i = 0; i < f.parameters.dim; i++)
-			{	Argument arg = cast(Argument)f.parameters.data[i];
-
+			foreach (arg; f.parameters)
+			{
 			//printf("[%d] arg.type.ty = %d %s\n", i, arg.type.ty, arg.type.toChars());
 			if (arg.type.ty == TY.Ttuple)
-			{   TypeTuple t = cast(TypeTuple)arg.type;
+			{   auto t = cast(TypeTuple)arg.type;
 				size_t dim = Argument.dim(t.arguments);
 				for (size_t j = 0; j < dim; j++)
 				{	Argument narg = Argument.getNth(t.arguments, j);
@@ -1114,13 +1113,12 @@
 		// but not in parameters[].
 		if (f.parameters)
 		{
-			for (size_t i = 0; i < f.parameters.dim; i++)
-			{	Argument arg = cast(Argument)f.parameters.data[i];
-
+			foreach (arg; f.parameters)
+			{
 			if (!arg.ident)
 				continue;			// never used, so ignore
 			if (arg.type.ty == TY.Ttuple)
-			{   TypeTuple t = cast(TypeTuple)arg.type;
+			{   auto t = cast(TypeTuple)arg.type;
 				size_t dim = Argument.dim(t.arguments);
 				Objects exps = new Objects();
 				exps.setDim(dim);
--- a/dmd/IsExp.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/IsExp.d	Fri Sep 03 23:25:55 2010 +0100
@@ -164,11 +164,11 @@
 						goto Lno;
 					else
 					{   ClassDeclaration cd = (cast(TypeClass)targ).sym;
-						Arguments args = new Arguments;
+						auto args = new Arguments;
 						args.reserve(cd.baseclasses.dim);
 						foreach (b; cd.baseclasses)
 						{	
-							args.push(cast(void*)new Argument(STCin, b.type, null, null));
+							args.push(new Argument(STCin, b.type, null, null));
 						}
 						tded = new TypeTuple(args);
 					}
@@ -201,9 +201,9 @@
 					args.reserve(dim);
 					for (size_t i = 0; i < dim; i++)
 					{   
-						Argument arg = Argument.getNth(params, i);
+						auto arg = Argument.getNth(params, i);
 						assert(arg && arg.type);
-						args.push(cast(void*)new Argument(arg.storageClass, arg.type, null, null));
+						args.push(new Argument(arg.storageClass, arg.type, null, null));
 					}
 					tded = new TypeTuple(args);
 					break;
--- a/dmd/Module.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/Module.d	Fri Sep 03 23:25:55 2010 +0100
@@ -1677,9 +1677,8 @@
 			}
 		}
 
-		for (int i = 0; i < aclasses.dim; i++)
+		foreach (cd; aclasses)
 		{
-			ClassDeclaration cd = cast(ClassDeclaration)aclasses.data[i];
 			dtxoff(&dt, cd.toSymbol(), 0, TYM.TYnptr);
 		}
 
--- a/dmd/Parser.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/Parser.d	Fri Sep 03 23:25:55 2010 +0100
@@ -1222,9 +1222,8 @@
 							 * a deduced type.
 							 */
 							TemplateParameters tpl = null;
-							for (int i = 0; i < tf.parameters.dim; i++)
+							foreach (param; tf.parameters)
 							{   
-								Argument param = cast(Argument)tf.parameters.data[i];
 								if (param.ident is null &&
 									param.type &&
 									param.type.ty == Tident &&
@@ -1234,7 +1233,7 @@
 									/* Switch parameter type to parameter identifier,
 									 * parameterize with template type parameter _T
 									 */
-									TypeIdentifier pt = cast(TypeIdentifier)param.type;
+									auto pt = cast(TypeIdentifier)param.type;
 									param.ident = pt.ident;
 									Identifier id = Lexer.uniqueId("__T");
 									param.type = new TypeIdentifier(pt.loc, id);
@@ -1882,13 +1881,13 @@
 					error("variadic argument cannot be out or ref");
 				varargs = 2;
 				a = new Argument(storageClass, at, ai, ae);
-				arguments.push(cast(void*)a);
+				arguments.push(a);
 				nextToken();
 				break;
 				}
 			L3:
 				a = new Argument(storageClass, at, ai, ae);
-				arguments.push(cast(void*)a);
+				arguments.push(a);
 				if (token.value == TOK.TOKcomma)
 				{   nextToken();
 				goto L1;
@@ -3469,7 +3468,7 @@
 				error("no identifier for declarator %s", at.toChars());
 			  Larg:
 			a = new Argument(storageClass, at, ai, null);
-			arguments.push(cast(void*)a);
+			arguments.push(a);
 			if (token.value == TOK.TOKcomma)
 			{   nextToken();
 				continue;
@@ -3481,7 +3480,7 @@
 			aggr = parseExpression();
 			if (token.value == TOK.TOKslice && arguments.dim == 1)
 			{
-			Argument a = cast(Argument)arguments.data[0];
+			auto a = arguments[0];
 			delete arguments;
 			nextToken();
 			Expression upr = parseExpression();
--- a/dmd/SliceExp.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/SliceExp.d	Fri Sep 03 23:25:55 2010 +0100
@@ -223,12 +223,12 @@
 				}
 				else
 				{	
-					Arguments args = new Arguments;
+					auto args = new Arguments;
 					args.reserve(j2 - j1);
 					for (size_t i = j1; i < j2; i++)
 					{   
-						Argument arg = Argument.getNth(tup.arguments, i);
-						args.push(cast(void*)arg);
+						auto arg = Argument.getNth(tup.arguments, i);
+						args.push(arg);
 					}
 					e = new TypeExp(e1.loc, new TypeTuple(args));
 				}
@@ -512,8 +512,8 @@
 	override Expression buildArrayLoop(Arguments fparams)
 	{
 		Identifier id = Identifier.generateId("p", fparams.dim);
-		Argument param = new Argument(STCconst, type, id, null);
-		fparams.shift(cast(void*)param);
+		auto param = new Argument(STCconst, type, id, null);
+		fparams.shift(param);
 		Expression e = new IdentifierExp(Loc(0), id);
 		Expressions arguments = new Expressions();
 		Expression index = new IdentifierExp(Loc(0), Id.p);
--- a/dmd/StructDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/StructDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -231,20 +231,20 @@
 
 		TypeFunction tfeqptr;
 		{
-		Arguments arguments = new Arguments;
-		Argument arg = new Argument(STC.STCin, handle, Id.p, null);
+		auto arguments = new Arguments;
+		auto arg = new Argument(STC.STCin, handle, Id.p, null);
 
-		arguments.push(cast(void*)arg);
+		arguments.push(arg);
 		tfeqptr = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd);
 		tfeqptr = cast(TypeFunction)tfeqptr.semantic(Loc(0), sc);
 		}
 
 		TypeFunction tfeq;
 		{
-		Arguments arguments = new Arguments;
-		Argument arg = new Argument(STC.STCin, type, null, null);
+		auto arguments = new Arguments;
+		auto arg = new Argument(STC.STCin, type, null, null);
 
-		arguments.push(cast(void*)arg);
+		arguments.push(arg);
 		tfeq = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd);
 		tfeq = cast(TypeFunction)tfeq.semantic(Loc(0), sc);
 		}
@@ -437,9 +437,9 @@
 
 		FuncDeclaration fop = null;
 
-		Argument param = new Argument(STC.STCnodtor, type, Id.p, null);
-		Arguments fparams = new Arguments;
-		fparams.push(cast(void*)param);
+		auto param = new Argument(STC.STCnodtor, type, Id.p, null);
+		auto fparams = new Arguments;
+		fparams.push(param);
 		Type ftype = new TypeFunction(fparams, handle, false, LINK.LINKd);
 version (STRUCTTHISREF) {
 		(cast(TypeFunction)ftype).isref = 1;
@@ -652,9 +652,9 @@
 		{
 		//printf("generating cpctor\n");
 
-		Argument param = new Argument(STC.STCref, type, Id.p, null);
-		Arguments fparams = new Arguments;
-		fparams.push(cast(void*)param);
+		auto param = new Argument(STC.STCref, type, Id.p, null);
+		auto fparams = new Arguments;
+		fparams.push(param);
 		Type ftype = new TypeFunction(fparams, Type.tvoid, false, LINK.LINKd);
 
 		fcp = new FuncDeclaration(Loc(0), Loc(0), Id.cpctor, STC.STCundefined, ftype);
@@ -665,7 +665,7 @@
 } else {
 		e = new PtrExp(Loc(0), e);
 }
-		AssignExp ea = new AssignExp(Loc(0), e, new IdentifierExp(Loc(0), Id.p));
+		auto ea = new AssignExp(Loc(0), e, new IdentifierExp(Loc(0), Id.p));
 		ea.op = TOK.TOKblit;
 		Statement s = new ExpStatement(Loc(0), ea);
 
--- a/dmd/TemplateDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TemplateDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -838,10 +838,10 @@
 				 */
 				for (fptupindex = 0; fptupindex < nfparams; fptupindex++)
 				{
-					Argument fparam = cast(Argument)fparameters.data[fptupindex];
+					auto fparam = fparameters[fptupindex];
 					if (fparam.type.ty != Tident)
 						continue;
-					TypeIdentifier tid = cast(TypeIdentifier)fparam.type;
+					auto tid = cast(TypeIdentifier)fparam.type;
 					if (!tp.ident.equals(tid.ident) || tid.idents.dim)
 						continue;
 
--- a/dmd/TemplateInstance.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TemplateInstance.d	Fri Sep 03 23:25:55 2010 +0100
@@ -868,7 +868,7 @@
 					if (ta.ty == Ttuple)
 					{   
 						// Expand tuple
-						TypeTuple tt = cast(TypeTuple)ta;
+						auto tt = cast(TypeTuple)ta;
 						size_t dim = tt.arguments.dim;
 						tiargs.remove(j);
 						if (dim)
@@ -876,7 +876,7 @@
 							tiargs.reserve(dim);
 							for (size_t i = 0; i < dim; i++)
 							{   
-								auto arg = cast(Argument)tt.arguments.data[i];
+								auto arg = tt.arguments[i];
 								tiargs.insert(j + i, arg.type);
 							}
 						}
--- a/dmd/TupleDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TupleDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -84,7 +84,7 @@
 } else {
 					auto arg = new Argument(STCundefined, t, null, null);
 }
-				args.data[i] = cast(void *)arg;
+				args[i] = arg;
 				if (!t.deco)
 					hasdeco = false;
 			}
--- a/dmd/TypeFunction.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeFunction.d	Fri Sep 03 23:25:55 2010 +0100
@@ -505,9 +505,8 @@
 	{
 		if (parameters)
 		{
-			for (size_t i = 0; i < parameters.dim; i++)
+			foreach (arg; parameters)
 			{   
-				Argument arg = cast(Argument)parameters.data[i];
 				Type t = arg.type.reliesOnTident();
 				if (t)
 					return t;
--- a/dmd/TypeInfoStructDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeInfoStructDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -100,16 +100,16 @@
 		{	
 			// bool opEqual(const T*) const;
 			scope Scope sc = new Scope();
-			Arguments arguments = new Arguments;
+			auto arguments = new Arguments;
 		version (STRUCTTHISREF) {
 			// arg type is ref const T
-			Argument arg = new Argument(STC.STCref, tc.constOf(), null, null);
+			auto arg = new Argument(STC.STCref, tc.constOf(), null, null);
 		} else {
 			// arg type is const T*
-			Argument arg = new Argument(STC.STCin, tc.pointerTo(), null, null);
+			auto arg = new Argument(STC.STCin, tc.pointerTo(), null, null);
 		}
 
-			arguments.push(cast(void*)arg);
+			arguments.push(arg);
 			tfeqptr = new TypeFunction(arguments, Type.tbool, 0, LINK.LINKd);
 			tfeqptr.mod = MOD.MODconst;
 			tfeqptr = cast(TypeFunction)tfeqptr.semantic(Loc(0), sc);
@@ -118,16 +118,16 @@
 		TypeFunction tfcmpptr;
 		{
 			scope Scope sc = new Scope();
-			Arguments arguments = new Arguments;
+			auto arguments = new Arguments;
 		version (STRUCTTHISREF) {
 			// arg type is ref const T
-			Argument arg = new Argument(STC.STCref, tc.constOf(), null, null);
+			auto arg = new Argument(STC.STCref, tc.constOf(), null, null);
 		} else {
 			// arg type is const T*
-			Argument arg = new Argument(STC.STCin, tc.pointerTo(), null, null);
+			auto arg = new Argument(STC.STCin, tc.pointerTo(), null, null);
 		}
 
-			arguments.push(cast(void*)arg);
+			arguments.push(arg);
 			tfcmpptr = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd);
 			tfcmpptr.mod = MOD.MODconst;
 			tfcmpptr = cast(TypeFunction)tfcmpptr.semantic(Loc(0), sc);
--- a/dmd/TypeInfoTupleDeclaration.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeInfoTupleDeclaration.d	Fri Sep 03 23:25:55 2010 +0100
@@ -30,7 +30,7 @@
 
 		assert(tinfo.ty == Ttuple);
 
-		TypeTuple tu = cast(TypeTuple)tinfo;
+		auto tu = cast(TypeTuple)tinfo;
 
 		size_t dim = tu.arguments.dim;
 		dtdword(pdt, dim);			    // elements.length
@@ -38,7 +38,7 @@
 		dt_t* d = null;
 		for (size_t i = 0; i < dim; i++)
 		{	
-			Argument arg = cast(Argument)tu.arguments.data[i];
+			auto arg = tu.arguments[i];
 			Expression e = arg.type.getTypeInfo(null);
 			e = e.optimize(WANTvalue);
 			e.toDt(&d);
--- a/dmd/TypeSArray.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeSArray.d	Fri Sep 03 23:25:55 2010 +0100
@@ -196,7 +196,7 @@
 			case TY.Ttuple:
 			{   // Index the tuple to get the type
 				assert(dim);
-				TypeTuple tt = cast(TypeTuple)tbn;
+				auto tt = cast(TypeTuple)tbn;
 				ulong d = dim.toUInteger();
 
 				if (d >= tt.arguments.dim)
@@ -204,7 +204,7 @@
 					error(loc, "tuple index %ju exceeds %u", d, tt.arguments.dim);
 					return Type.terror;
 				}
-				Argument arg = cast(Argument)tt.arguments.data[cast(size_t)d];
+				auto arg = tt.arguments[cast(size_t)d];
 				return arg.type;
 			}
 			case TY.Tstruct:
--- a/dmd/TypeSlice.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeSlice.d	Fri Sep 03 23:25:55 2010 +0100
@@ -79,12 +79,12 @@
 			return Type.terror;
 		}
 
-		Arguments args = new Arguments;
+		auto args = new Arguments;
 		args.reserve(cast(size_t)(i2 - i1));
 		for (size_t i = cast(size_t)i1; i < cast(size_t)i2; i++)
 		{	
-			Argument arg = cast(Argument)tt.arguments.data[i];
-			args.push(cast(void*)arg);
+			auto arg = tt.arguments[i];
+			args.push(arg);
 		}
 
 		return new TypeTuple(args);
--- a/dmd/TypeTuple.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/TypeTuple.d	Fri Sep 03 23:25:55 2010 +0100
@@ -32,9 +32,8 @@
 		debug {
 			if (arguments)
 			{
-				for (size_t i = 0; i < arguments.dim; i++)
+				foreach (arg; arguments)
 				{
-					Argument arg = cast(Argument)arguments.data[i];
 					assert(arg && arg.type);
 				}
 			}
@@ -65,7 +64,7 @@
 				if (e.type.ty == Ttuple)
 					e.error("cannot form tuple of tuples");
 				auto arg = new Argument(STCundefined, e.type, null, null);
-				arguments.data[i] = cast(void *)arg;
+				arguments[i] = arg;
 			}
 		}
 		this.arguments = arguments;
@@ -73,8 +72,8 @@
 
 	override Type syntaxCopy()
 	{
-		Arguments args = Argument.arraySyntaxCopy(arguments);
-		Type t = new TypeTuple(args);
+		auto args = Argument.arraySyntaxCopy(arguments);
+		auto t = new TypeTuple(args);
 		t.mod = mod;
 		return t;
 	}
@@ -108,8 +107,8 @@
 			if (arguments.dim == tt.arguments.dim)
 			{
 				for (size_t i = 0; i < tt.arguments.dim; i++)
-				{   Argument arg1 = cast(Argument)arguments.data[i];
-					Argument arg2 = cast(Argument)tt.arguments.data[i];
+				{   auto arg1 = arguments[i];
+					auto arg2 = tt.arguments[i];
 
 					if (!arg1.type.equals(arg2.type))
 						return 0;
@@ -124,10 +123,9 @@
 	{
 		if (arguments)
 		{
-			for (size_t i = 0; i < arguments.dim; i++)
+			foreach (arg; arguments)
 			{
-				Argument arg = cast(Argument)arguments.data[i];
-				Type t = arg.type.reliesOnTident();
+				auto t = arg.type.reliesOnTident();
 				if (t)
 					return t;
 			}
--- a/dmd/expression/Util.d	Fri Sep 03 22:17:54 2010 +0100
+++ b/dmd/expression/Util.d	Fri Sep 03 23:25:55 2010 +0100
@@ -952,12 +952,12 @@
 
 	/* Create the TypeTuple corresponding to the types of args[]
 	 */
-	Arguments args = new Arguments;
+	auto args = new Arguments;
 	args.setDim(dim);
 	for (size_t i = 0; i < dim; i++)
 	{	
-		Argument arg = new Argument(STCin, exps[i].type, null, null);
-		args.data[i] = cast(void*)arg;
+		auto arg = new Argument(STCin, exps[i].type, null, null);
+		args[i] = arg;
 	}
 	TypeTuple tup = new TypeTuple(args);
 	Expression e = tup.getTypeInfo(sc);
@@ -1284,14 +1284,14 @@
 		if (u == arguments.dim)
 			return;
 
-		Argument arg = cast(Argument)arguments.data[u];
+		auto arg = arguments[u];
 		if (!arg.type)
 			break;
     }
 
     AggregateDeclaration ad;
 
-    Argument arg = cast(Argument)arguments.data[0];
+    auto arg = arguments[0];
     Type taggr = aggr.type;
     if (!taggr)
 		return;
@@ -1305,7 +1305,7 @@
 			{
 				if (!arg.type)
 					arg.type = Type.tsize_t;	// key type
-				arg = cast(Argument)arguments.data[1];
+				arg = arguments[1];
 			}
 			if (!arg.type && tab.ty != TY.Ttuple)
 				arg.type = tab.nextOf();	// value type
@@ -1319,7 +1319,7 @@
 			{
 				if (!arg.type)
 					arg.type = taa.index;	// key type
-				arg = cast(Argument)arguments.data[1];
+				arg = arguments[1];
 			}
 			if (!arg.type)
 				arg.type = taa.next;		// value type
@@ -1465,7 +1465,7 @@
 
     for (size_t u = 0; u < nparams; u++)
     {
-		Argument arg = cast(Argument)arguments.data[u];
+		auto arg = arguments[u];
 		Argument param = Argument.getNth(tf.parameters, u);
 		if (arg.type)
 		{