diff dmd/CallExp.d @ 84:be2ab491772e

Expressions -> Vector!Expression
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 30 Aug 2010 16:12:19 +0100
parents 43073c7c7769
children 39648eb578f6
line wrap: on
line diff
--- a/dmd/CallExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/CallExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -93,11 +93,11 @@
 	{
 		super(loc, TOK.TOKcall, CallExp.sizeof, e);
 		
-		Expressions arguments = new Expressions();
+		auto arguments = new Expressions();
 	    if (earg1)
 		{	
 			arguments.setDim(1);
-			arguments.data[0] = cast(void*)earg1;
+			arguments[0] = earg1;
 		}
 		this.arguments = arguments;
 	}
@@ -106,10 +106,10 @@
 	{
 		super(loc, TOK.TOKcall, CallExp.sizeof, e);
 		
-		Expressions arguments = new Expressions();
+		auto arguments = new Expressions();
 		arguments.setDim(2);
-		arguments.data[0] = cast(void*)earg1;
-		arguments.data[1] = cast(void*)earg2;
+		arguments.data[0] = earg1;
+		arguments.data[1] = earg2;
 
 		this.arguments = arguments;
 	}
@@ -188,7 +188,7 @@
 				{
 					if (!arguments)
 						arguments = new Expressions();
-					arguments.shift(cast(void*)dotid.e1);
+					arguments.shift(dotid.e1);
 version (DMDV2) {
 					e1 = new DotIdExp(dotid.loc, new IdentifierExp(dotid.loc, Id.empty), dotid.ident);
 } else {
@@ -784,12 +784,9 @@
 		// Optimize parameters
 		if (arguments)
 		{
-			for (size_t i = 0; i < arguments.dim; i++)
+			foreach (ref Expression ee; arguments)
 			{   
-				Expression ee = cast(Expression)arguments.data[i];
-
 				ee = ee.optimize(WANT.WANTvalue);
-				arguments.data[i] = cast(void*)ee;
 			}
 		}
 
@@ -862,11 +859,11 @@
 					args.setDim(arguments.dim);
 					for (size_t i = 0; i < args.dim; i++)
 					{
-						Expression earg = cast(Expression)arguments.data[i];
+						auto earg = arguments[i];
 						earg = earg.interpret(istate);
 						if (earg == EXP_CANT_INTERPRET)
 							return earg;
-						args.data[i] = cast(void*)earg;
+						args[i] = earg;
 					}
 					e = eval_builtin(b, args);
 					if (!e)