comparison dmd/statement.c @ 275:665b81613475 trunk

[svn r296] Removed: the 'suite' dir, it never took off! Fixed: foreach statement, key-type checks were buggy. Fixed: setting LLVMDC versions on the command line is now an error. Fixed: array compare runtime had incorrect param attrs on call. Fixed: index expressions on dynamic array slices w/o storage was broken. Fixed: scope classes had incorrect finalization in some cases. Fixed: when outputting !ClassInfoS !OffsetTypeInfoS, static class members were trying to be included, crashing the compiler. Fixed: calling LLVMDC with -inline but not any -O option caused assertion failure. Changed: the runtime now uses a single interface to "get" to !TypeInfoS, part of eliminating duplicate !TypeInfo codegen.
author lindquist
date Thu, 19 Jun 2008 17:30:32 +0200
parents 88252a1af660
children 3ebc136702dd
comparison
equal deleted inserted replaced
274:9f228c1e5311 275:665b81613475
1178 if (dim == 2) 1178 if (dim == 2)
1179 { // Declare key 1179 { // Declare key
1180 if (arg->storageClass & (STCout | STCref | STClazy)) 1180 if (arg->storageClass & (STCout | STCref | STClazy))
1181 error("no storage class for key %s", arg->ident->toChars()); 1181 error("no storage class for key %s", arg->ident->toChars());
1182 TY keyty = arg->type->ty; 1182 TY keyty = arg->type->ty;
1183 if ((keyty != Tint32 && keyty != Tuns32) && 1183 if (global.params.is64bit)
1184 (global.params.is64bit && keyty != Tint64 && keyty != Tuns64) 1184 {
1185 ) 1185 if (keyty != Tint32 && keyty != Tuns32 && keyty != Tint64 && keyty != Tuns64)
1186 { 1186 {
1187 error("foreach: key type must be %s, not %s", global.params.is64bit ? "int, uint, long or ulong" : "int or uint",arg->type->toChars()); 1187 error("foreach: key type must be int, uint, long or ulong, not %s", key->type->toChars());
1188 } 1188 }
1189 }
1190 else if (keyty != Tint32 && keyty != Tuns32)
1191 {
1192 error("foreach: key type must be int or uint, not %s", key->type->toChars());
1193 }
1189 Initializer *ie = new ExpInitializer(0, new IntegerExp(k)); 1194 Initializer *ie = new ExpInitializer(0, new IntegerExp(k));
1190 VarDeclaration *var = new VarDeclaration(loc, arg->type, arg->ident, ie); 1195 VarDeclaration *var = new VarDeclaration(loc, arg->type, arg->ident, ie);
1191 var->storage_class |= STCconst; 1196 var->storage_class |= STCconst;
1192 DeclarationExp *de = new DeclarationExp(loc, var); 1197 DeclarationExp *de = new DeclarationExp(loc, var);
1193 st->push(new ExpStatement(loc, de)); 1198 st->push(new ExpStatement(loc, de));
1318 aggr = aggr->implicitCastTo(sc, value->type->arrayOf()); 1323 aggr = aggr->implicitCastTo(sc, value->type->arrayOf());
1319 else 1324 else
1320 error("foreach: %s is not an array of %s", tab->toChars(), value->type->toChars()); 1325 error("foreach: %s is not an array of %s", tab->toChars(), value->type->toChars());
1321 } 1326 }
1322 1327
1323 if (key && 1328 if (key)
1324 ((key->type->ty != Tint32 && key->type->ty != Tuns32) && 1329 {
1325 (global.params.is64bit && key->type->ty != Tint64 && key->type->ty != Tuns64) 1330 if (global.params.is64bit)
1326 ) 1331 {
1327 ) 1332 if (key->type->ty != Tint32 && key->type->ty != Tuns32 && key->type->ty != Tint64 && key->type->ty != Tuns64)
1328 { 1333 {
1329 error("foreach: key type must be %s, not %s", global.params.is64bit ? "int, uint, long or ulong" : "int or uint", key->type->toChars()); 1334 error("foreach: key type must be int, uint, long or ulong, not %s", key->type->toChars());
1330 } 1335 }
1336 }
1337 else if (key->type->ty != Tint32 && key->type->ty != Tuns32)
1338 {
1339 error("foreach: key type must be int or uint, not %s", key->type->toChars());
1340 }
1341 }
1331 1342
1332 if (key && key->storage_class & (STCout | STCref)) 1343 if (key && key->storage_class & (STCout | STCref))
1333 error("foreach: key cannot be out or ref"); 1344 error("foreach: key cannot be out or ref");
1334 break; 1345 break;
1335 1346