Mercurial > projects > ddmd
diff dmd/AggregateDeclaration.d @ 77:ad4792a1cfd6
more D-ification container accessing
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Sun, 29 Aug 2010 14:36:55 +0100 |
parents | 7e0d548de9e6 |
children | 43073c7c7769 |
line wrap: on
line diff
--- a/dmd/AggregateDeclaration.d Sun Aug 29 09:43:40 2010 +0100 +++ b/dmd/AggregateDeclaration.d Sun Aug 29 14:36:55 2010 +0100 @@ -198,11 +198,8 @@ if (members) { sc = sc.push(this); - for (size_t i = 0; i < members.dim; i++) - { - Dsymbol s = cast(Dsymbol)members.data[i]; + foreach(Dsymbol s; members) s.semantic2(sc); - } sc.pop(); } } @@ -215,11 +212,8 @@ if (members) { sc = sc.push(this); - for (i = 0; i < members.dim; i++) - { - Dsymbol s = cast(Dsymbol)members.data[i]; + foreach(Dsymbol s; members) s.semantic3(sc); - } sc.pop(); } } @@ -231,9 +225,8 @@ //printf("AggregateDeclaration.inlineScan(%s)\n", toChars()); if (members) { - for (i = 0; i < members.dim; i++) + foreach(Dsymbol s; members) { - Dsymbol s = cast(Dsymbol)members.data[i]; //printf("inline scan aggregate symbol '%s'\n", s.toChars()); s.inlineScan(); } @@ -417,19 +410,18 @@ return null; case 1: - return cast(FuncDeclaration)dtors.data[0]; + return cast(FuncDeclaration)dtors[0]; default: e = null; - for (size_t i = 0; i < dtors.dim; i++) + foreach(FuncDeclaration fd; dtors) { - FuncDeclaration fd = cast(FuncDeclaration)dtors.data[i]; Expression ex = new ThisExp(Loc(0)); ex = new DotVarExp(Loc(0), ex, fd, 0); ex = new CallExp(Loc(0), ex); e = Expression.combine(ex, e); } - DtorDeclaration dd = new DtorDeclaration(Loc(0), Loc(0), Lexer.idPool("__aggrDtor")); + auto dd = new DtorDeclaration(Loc(0), Loc(0), Lexer.idPool("__aggrDtor")); dd.fbody = new ExpStatement(Loc(0), e); members.push(dd); dd.semantic(sc);