[svn r38] * resizing dynamic arrays support

* throw is replaced with assert(0)
* catch is ignored
* better foreach support
* various bugfixes
This commit is contained in:
Tomas Lindquist Olsen
2007-10-09 02:50:00 +02:00
parent e17f720cce
commit 3db5b9bb98
17 changed files with 296 additions and 94 deletions

View File

@@ -1173,12 +1173,11 @@ Statement *ForeachStatement::semantic(Scope *sc)
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 @@ Statement *ForeachStatement::semantic(Scope *sc)
}
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))