Mercurial > projects > ddmd
comparison dmd/Argument.d @ 126:1765f3ef917d
ClassDeclarations, Arguments -> Vector
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Fri, 03 Sep 2010 23:25:55 +0100 |
parents | e28b18c23469 |
children |
comparison
equal
deleted
inserted
replaced
125:767a01c2a272 | 126:1765f3ef917d |
---|---|
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 static Arguments arraySyntaxCopy(Arguments args) | 105 static Arguments arraySyntaxCopy(Arguments args) |
106 { | 106 { |
107 Arguments a = null; | 107 typeof(return) a = null; |
108 | 108 |
109 if (args) | 109 if (args) |
110 { | 110 { |
111 a = new Arguments(); | 111 a = new Arguments(); |
112 a.setDim(args.dim); | 112 a.setDim(args.dim); |
113 | 113 |
114 for (size_t i = 0; i < a.dim; i++) | 114 for (size_t i = 0; i < a.dim; i++) |
115 { | 115 { |
116 Argument arg = cast(Argument)args.data[i]; | 116 auto arg = args[i]; |
117 | 117 |
118 arg = arg.syntaxCopy(); | 118 arg = arg.syntaxCopy(); |
119 a.data[i] = cast(void*)arg; | 119 a[i] = arg; |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 return a; | 123 return a; |
124 } | 124 } |
173 | 173 |
174 for (i = 0; i < arguments.dim; i++) | 174 for (i = 0; i < arguments.dim; i++) |
175 { | 175 { |
176 if (i) | 176 if (i) |
177 buf.writestring(", "); | 177 buf.writestring(", "); |
178 Argument arg = cast(Argument)arguments.data[i]; | 178 auto arg = arguments[i]; |
179 | 179 |
180 if (arg.storageClass & STCout) | 180 if (arg.storageClass & STCout) |
181 buf.writestring("out "); | 181 buf.writestring("out "); |
182 else if (arg.storageClass & STCref) | 182 else if (arg.storageClass & STCref) |
183 buf.writestring((global.params.Dversion == 1) ? "inout " : "ref "); | 183 buf.writestring((global.params.Dversion == 1) ? "inout " : "ref "); |
248 static size_t dim(Arguments args) | 248 static size_t dim(Arguments args) |
249 { | 249 { |
250 size_t n = 0; | 250 size_t n = 0; |
251 if (args) | 251 if (args) |
252 { | 252 { |
253 for (size_t i = 0; i < args.dim; i++) | 253 foreach (arg; args) |
254 { | 254 { |
255 Argument arg = cast(Argument)args.data[i]; | |
256 Type t = arg.type.toBasetype(); | 255 Type t = arg.type.toBasetype(); |
257 | 256 |
258 if (t.ty == TY.Ttuple) | 257 if (t.ty == TY.Ttuple) |
259 { | 258 { |
260 TypeTuple tu = cast(TypeTuple)t; | 259 auto tu = cast(TypeTuple)t; |
261 n += dim(tu.arguments); | 260 n += dim(tu.arguments); |
262 } | 261 } |
263 else | 262 else |
264 n++; | 263 n++; |
265 } | 264 } |
278 { | 277 { |
279 if (!args) | 278 if (!args) |
280 return null; | 279 return null; |
281 | 280 |
282 size_t n = 0; | 281 size_t n = 0; |
283 for (size_t i = 0; i < args.dim; i++) | 282 foreach (arg; args) |
284 { | 283 { |
285 Argument arg = cast(Argument)args.data[i]; | |
286 Type t = arg.type.toBasetype(); | 284 Type t = arg.type.toBasetype(); |
287 | 285 |
288 if (t.ty == TY.Ttuple) | 286 if (t.ty == TY.Ttuple) |
289 { TypeTuple tu = cast(TypeTuple)t; | 287 { TypeTuple tu = cast(TypeTuple)t; |
290 arg = getNth(tu.arguments, nth - n, &n); | 288 arg = getNth(tu.arguments, nth - n, &n); |