Mercurial > projects > ddmd
diff dmd/ForeachStatement.d @ 96:acd69f84627e
further work
author | Trass3r |
---|---|
date | Tue, 31 Aug 2010 02:12:15 +0200 |
parents | 39648eb578f6 |
children | e28b18c23469 |
line wrap: on
line diff
--- a/dmd/ForeachStatement.d Mon Aug 30 23:08:44 2010 +0200 +++ b/dmd/ForeachStatement.d Tue Aug 31 02:12:15 2010 +0200 @@ -253,6 +253,7 @@ sc.noctor++; + Lagain: switch (tab.ty) { case TY.Tarray: @@ -318,13 +319,15 @@ var.storage_class |= STC.STCconst; } } -static if (false) { +static if (false) +{ DeclarationExp de = new DeclarationExp(loc, var); de.semantic(sc); } } -static if (true) { +static if (true) +{ { /* Convert to a ForStatement * foreach (key, value; a) body => @@ -423,12 +426,21 @@ error("only one or two arguments for associative array foreach"); break; } +version(SARRAYVALUE) +{ + /* This only works if Key or Value is a static array. + */ + tab = taa.getImpl().type; + goto Lagain; +} +else +{ if (op == TOK.TOKforeach_reverse) { error("no reverse iteration on associative arrays"); } goto Lapply; - +} case TY.Tclass: case TY.Tstruct: version (DMDV2) {