Mercurial > projects > ddmd
comparison dmd/TemplateTupleParameter.d @ 113:3482c73a991b
More cleanup for arrays
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Tue, 31 Aug 2010 23:57:32 +0100 |
parents | 3a0b150c9841 |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
112:3f02152c5e68 | 113:3482c73a991b |
---|---|
64 for (int i = 0; i < v.objects.dim; i++) | 64 for (int i = 0; i < v.objects.dim; i++) |
65 { | 65 { |
66 if (i) | 66 if (i) |
67 writef(", "); | 67 writef(", "); |
68 | 68 |
69 Object o = cast(Object)v.objects.data[i]; | 69 Object o = v.objects[i]; |
70 | 70 |
71 Dsymbol sa = isDsymbol(o); | 71 Dsymbol sa = isDsymbol(o); |
72 if (sa) | 72 if (sa) |
73 writef("alias: %s", sa.toChars()); | 73 writef("alias: %s", sa.toChars()); |
74 | 74 |
120 /* The rest of the actual arguments (tiargs[]) form the match | 120 /* The rest of the actual arguments (tiargs[]) form the match |
121 * for the variadic parameter. | 121 * for the variadic parameter. |
122 */ | 122 */ |
123 assert(i + 1 == dedtypes.dim); // must be the last one | 123 assert(i + 1 == dedtypes.dim); // must be the last one |
124 Tuple ovar; | 124 Tuple ovar; |
125 if (i + 1 == tiargs.dim && isTuple(cast(Object)tiargs.data[i])) | 125 if (i + 1 == tiargs.dim && isTuple(tiargs[i])) |
126 ovar = isTuple(cast(Object)tiargs.data[i]); | 126 ovar = isTuple(tiargs[i]); |
127 else | 127 else |
128 { | 128 { |
129 ovar = new Tuple(); | 129 ovar = new Tuple(); |
130 //printf("ovar = %p\n", ovar); | 130 //printf("ovar = %p\n", ovar); |
131 if (i < tiargs.dim) | 131 if (i < tiargs.dim) |
132 { | 132 { |
133 //printf("i = %d, tiargs.dim = %d\n", i, tiargs.dim); | 133 //printf("i = %d, tiargs.dim = %d\n", i, tiargs.dim); |
134 ovar.objects.setDim(tiargs.dim - i); | 134 ovar.objects.setDim(tiargs.dim - i); |
135 for (size_t j = 0; j < ovar.objects.dim; j++) | 135 for (size_t j = 0; j < ovar.objects.dim; j++) |
136 ovar.objects.data[j] = tiargs.data[i + j]; | 136 ovar.objects[j] = tiargs[i + j]; |
137 } | 137 } |
138 } | 138 } |
139 *psparam = new TupleDeclaration(loc, ident, ovar.objects); | 139 *psparam = new TupleDeclaration(loc, ident, ovar.objects); |
140 dedtypes[i] = ovar; | 140 dedtypes[i] = ovar; |
141 | 141 |