diff dmd/ForeachStatement.d @ 122:c77e9f4f1793

Statements -> Vector
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Thu, 02 Sep 2010 23:37:49 +0100
parents e28b18c23469
children 1765f3ef917d
line wrap: on
line diff
--- a/dmd/ForeachStatement.d	Thu Sep 02 22:41:12 2010 +0100
+++ b/dmd/ForeachStatement.d	Thu Sep 02 23:37:49 2010 +0100
@@ -203,7 +203,7 @@
 					VarDeclaration var = new VarDeclaration(loc, arg.type, arg.ident, ie);
 					var.storage_class |= STC.STCmanifest;
 					DeclarationExp de = new DeclarationExp(loc, var);
-					st.push(cast(void*)new ExpStatement(loc, de));
+					st.push(new ExpStatement(loc, de));
 					arg = cast(Argument)arguments.data[1];	// value
 				}
 				// Declare value
@@ -234,13 +234,13 @@
 					var = new AliasDeclaration(loc, arg.ident, t);
 				}
 
-				DeclarationExp de = new DeclarationExp(loc, var);
-				st.push(cast(void*)new ExpStatement(loc, de));
+				auto de = new DeclarationExp(loc, var);
+				st.push(new ExpStatement(loc, de));
 
-				st.push(cast(void*)body_.syntaxCopy());
+				st.push(body_.syntaxCopy());
 				s = new CompoundStatement(loc, st);
 				s = new ScopeStatement(loc, s);
-				statements.push(cast(void*)s);
+				statements.push(s);
 			}
 
 			s = new UnrolledLoopStatement(loc, statements);
@@ -356,9 +356,9 @@
 				else
 					key.init = new ExpInitializer(loc, new IntegerExp(0));
 
-				Statements cs = new Statements();
-				cs.push(cast(void*)new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
-				cs.push(cast(void*)new DeclarationStatement(loc, new DeclarationExp(loc, key)));
+				auto cs = new Statements();
+				cs.push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
+				cs.push(new DeclarationStatement(loc, new DeclarationExp(loc, key)));
 				Statement forinit = new CompoundDeclarationStatement(loc, cs);
 
 				Expression cond;
@@ -600,15 +600,15 @@
 				// Resolve any forward referenced goto's
 				for (int i = 0; i < gotos.dim; i++)
 				{	
-					CompoundStatement cs = cast(CompoundStatement)gotos.data[i];
-					GotoStatement gs = cast(GotoStatement)cs.statements.data[0];
+					auto cs = cast(CompoundStatement)gotos.data[i];
+					auto gs = cast(GotoStatement)cs.statements[0];
 
 					if (!gs.label.statement)
 					{   
 						// 'Promote' it to this scope, and replace with a return
 						cases.push(cast(void*)gs);
 						s = new ReturnStatement(Loc(0), new IntegerExp(cases.dim + 1));
-						cs.statements.data[0] = cast(void*)s;
+						cs.statements[0] = s;
 					}
 				}
 
@@ -744,19 +744,19 @@
 				else
 				{	// Construct a switch statement around the return value
 					// of the apply function.
-					Statements a2 = new Statements();
+					auto a2 = new Statements();
 
 					// default: break; takes care of cases 0 and 1
 					s = new BreakStatement(Loc(0), null);
 					s = new DefaultStatement(Loc(0), s);
-					a2.push(cast(void*)s);
+					a2.push(s);
 
 					// cases 2...
 					for (int i = 0; i < cases.dim; i++)
 					{
 						s = cast(Statement)cases.data[i];
 						s = new CaseStatement(Loc(0), new IntegerExp(i + 2), s);
-						a2.push(cast(void*)s);
+						a2.push(s);
 					}
 
 					s = new CompoundStatement(loc, a2);