diff dmd/statement.c @ 34:4648206ca213 trunk

[svn r38] * resizing dynamic arrays support * throw is replaced with assert(0) * catch is ignored * better foreach support * various bugfixes
author lindquist
date Tue, 09 Oct 2007 02:50:00 +0200
parents 788401029ecf
children 77cdca8c210f
line wrap: on
line diff
--- a/dmd/statement.c	Thu Oct 04 22:38:53 2007 +0200
+++ b/dmd/statement.c	Tue Oct 09 02:50:00 2007 +0200
@@ -1173,12 +1173,11 @@
 		if (arg->storageClass & (STCout | STCref | STClazy))
 		    error("no storage class for key %s", arg->ident->toChars());
 		TY keyty = arg->type->ty;
-		if ((keyty != Tint32 && keyty != Tuns32) ||
-		    (global.params.is64bit &&
-			    keyty != Tint64 && keyty != Tuns64)
+		if ((keyty != Tint32 && keyty != Tuns32) &&
+		    (global.params.is64bit && keyty != Tint64 && keyty != Tuns64)
 		   )
 		{
-		    error("foreach: key type must be int or uint, not %s", arg->type->toChars());
+		    error("foreach: key type must be %s, not %s", global.params.is64bit ? "int, uint, long or ulong" : "int or uint",arg->type->toChars());
 		}
 		Initializer *ie = new ExpInitializer(0, new IntegerExp(k));
 		VarDeclaration *var = new VarDeclaration(loc, arg->type, arg->ident, ie);
@@ -1315,13 +1314,12 @@
 	    }
 
 	    if (key &&
-		((key->type->ty != Tint32 && key->type->ty != Tuns32) ||
-		 (global.params.is64bit &&
-			key->type->ty != Tint64 && key->type->ty != Tuns64)
+		((key->type->ty != Tint32 && key->type->ty != Tuns32) &&
+		 (global.params.is64bit && key->type->ty != Tint64 && key->type->ty != Tuns64)
 	        )
 	       )
 	    {
-		error("foreach: key type must be int or uint, not %s", key->type->toChars());
+        error("foreach: key type must be %s, not %s", global.params.is64bit ? "int, uint, long or ulong" : "int or uint", key->type->toChars());
 	    }
 
 	    if (key && key->storage_class & (STCout | STCref))