diff dmd/TupleDeclaration.d @ 32:81796b717a39

A few bad cast fixed. TODO: either get rid of dyncast(), or derive all objects from intermediate supertype.
author korDen
date Tue, 18 May 2010 17:51:46 +0400
parents 460959608115
children 2e2a5c3f943a
line wrap: on
line diff
--- a/dmd/TupleDeclaration.d	Tue Apr 13 21:26:45 2010 +0100
+++ b/dmd/TupleDeclaration.d	Tue May 18 17:51:46 2010 +0400
@@ -54,9 +54,10 @@
 			/* It's only a type tuple if all the Object's are types
 			 */
 			for (size_t i = 0; i < objects.dim; i++)
-			{   Dsymbol o = cast(Dsymbol)objects.data[i];
+			{   
+				Object o = cast(Object)objects.data[i];
 
-				if (o.dyncast() != DYNCAST.DYNCAST_TYPE)
+				if (cast(Type)o is null)
 				{
 					//printf("\tnot[%d], %p, %d\n", i, o, o->dyncast());
 					return null;
@@ -93,11 +94,13 @@
 	{
 		//printf("TupleDeclaration::needThis(%s)\n", toChars());
 		for (size_t i = 0; i < objects.dim; i++)
-		{   Dsymbol o = cast(Dsymbol)objects.data[i];
-			if (o.dyncast() == DYNCAST.DYNCAST_EXPRESSION)
-			{   Expression e = cast(Expression)o;
+		{   
+			Object o = cast(Object)objects.data[i];
+			if (auto e = cast(Expression)o)
+			{
 				if (e.op == TOKdsymbol)
-				{	DsymbolExp ve = cast(DsymbolExp)e;
+				{	
+					DsymbolExp ve = cast(DsymbolExp)e;
 					Declaration d = ve.s.isDeclaration();
 					if (d && d.needThis())
 					{