Mercurial > projects > ddmd
comparison dmd/StructDeclaration.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 |
comparison
equal
deleted
inserted
replaced
74:7e0d548de9e6 | 77:ad4792a1cfd6 |
---|---|
146 } | 146 } |
147 | 147 |
148 if (sizeok == 0) // if not already done the addMember step | 148 if (sizeok == 0) // if not already done the addMember step |
149 { | 149 { |
150 int hasfunctions = 0; | 150 int hasfunctions = 0; |
151 for (i = 0; i < members.dim; i++) | 151 foreach(Dsymbol s; members) |
152 { | 152 { |
153 Dsymbol s = cast(Dsymbol)members.data[i]; | |
154 //printf("adding member '%s' to '%s'\n", s.toChars(), this.toChars()); | 153 //printf("adding member '%s' to '%s'\n", s.toChars(), this.toChars()); |
155 s.addMember(sc, this, true); | 154 s.addMember(sc, this, true); |
156 if (s.isFuncDeclaration()) | 155 if (s.isFuncDeclaration()) |
157 hasfunctions = 1; | 156 hasfunctions = 1; |
158 } | 157 } |
200 sc2.inunion = 1; | 199 sc2.inunion = 1; |
201 sc2.protection = PROT.PROTpublic; | 200 sc2.protection = PROT.PROTpublic; |
202 sc2.explicitProtection = 0; | 201 sc2.explicitProtection = 0; |
203 | 202 |
204 int members_dim = members.dim; | 203 int members_dim = members.dim; |
205 for (i = 0; i < members_dim; i++) | 204 foreach(Dsymbol s; members) |
206 { | 205 { |
207 Dsymbol s = cast(Dsymbol)members.data[i]; | |
208 s.semantic(sc2); | 206 s.semantic(sc2); |
209 if (isUnionDeclaration()) | 207 if (isUnionDeclaration()) |
210 sc2.offset = 0; | 208 sc2.offset = 0; |
211 static if (false) { | 209 static if (false) { |
212 if (sizeok == 2) | 210 if (sizeok == 2) |
613 { | 611 { |
614 case 0: | 612 case 0: |
615 return null; | 613 return null; |
616 | 614 |
617 case 1: | 615 case 1: |
618 return cast(FuncDeclaration)postblits.data[0]; | 616 return cast(FuncDeclaration)postblits[0]; |
619 | 617 |
620 default: | 618 default: |
621 e = null; | 619 e = null; |
622 for (size_t i = 0; i < postblits.dim; i++) | 620 foreach(FuncDeclaration fd; postblits) |
623 { FuncDeclaration fd = cast(FuncDeclaration)postblits.data[i]; | 621 { |
624 Expression ex = new ThisExp(Loc(0)); | 622 Expression ex = new ThisExp(Loc(0)); |
625 ex = new DotVarExp(Loc(0), ex, fd, 0); | 623 ex = new DotVarExp(Loc(0), ex, fd, 0); |
626 ex = new CallExp(Loc(0), ex); | 624 ex = new CallExp(Loc(0), ex); |
627 e = Expression.combine(e, ex); | 625 e = Expression.combine(e, ex); |
628 } | 626 } |
779 } | 777 } |
780 outdata(sinit); | 778 outdata(sinit); |
781 } | 779 } |
782 | 780 |
783 // Put out the members | 781 // Put out the members |
784 for (uint i = 0; i < members.dim; i++) | 782 foreach(Dsymbol member; members) |
785 { | |
786 Dsymbol member = cast(Dsymbol)members.data[i]; | |
787 member.toObjFile(0); | 783 member.toObjFile(0); |
788 } | |
789 } | 784 } |
790 } | 785 } |
791 | 786 |
792 void toDt(dt_t** pdt) | 787 void toDt(dt_t** pdt) |
793 { | 788 { |