Mercurial > projects > ddmd
comparison dmd/NewExp.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | 9e39c7de8438 |
children | af724d3510d7 |
comparison
equal
deleted
inserted
replaced
129:010eb8f0e18d | 130:60bb0fe4563e |
---|---|
112 newtype = type; // in case type gets cast to something else | 112 newtype = type; // in case type gets cast to something else |
113 tb = type.toBasetype(); | 113 tb = type.toBasetype(); |
114 //printf("tb: %s, deco = %s\n", tb.toChars(), tb.deco); | 114 //printf("tb: %s, deco = %s\n", tb.toChars(), tb.deco); |
115 | 115 |
116 arrayExpressionSemantic(newargs, sc); | 116 arrayExpressionSemantic(newargs, sc); |
117 preFunctionArguments(loc, sc, newargs); | 117 preFunctionParameters(loc, sc, newargs); |
118 arrayExpressionSemantic(arguments, sc); | 118 arrayExpressionSemantic(arguments, sc); |
119 preFunctionArguments(loc, sc, arguments); | 119 preFunctionParameters(loc, sc, arguments); |
120 | 120 |
121 if (thisexp && tb.ty != Tclass) | 121 if (thisexp && tb.ty != Tclass) |
122 error("e.new is only for allocating nested classes, not %s", tb.toChars()); | 122 error("e.new is only for allocating nested classes, not %s", tb.toChars()); |
123 | 123 |
124 if (tb.ty == Tclass) | 124 if (tb.ty == Tclass) |
246 | 246 |
247 tf = cast(TypeFunction)f.type; | 247 tf = cast(TypeFunction)f.type; |
248 | 248 |
249 if (!arguments) | 249 if (!arguments) |
250 arguments = new Expressions(); | 250 arguments = new Expressions(); |
251 functionArguments(loc, sc, tf, arguments); | 251 functionParameters(loc, sc, tf, arguments); |
252 } | 252 } |
253 else | 253 else |
254 { | 254 { |
255 if (arguments && arguments.dim) | 255 if (arguments && arguments.dim) |
256 error("no constructor for %s", cd.toChars()); | 256 error("no constructor for %s", cd.toChars()); |
267 f = cd.aggNew.overloadResolve(loc, null, newargs); | 267 f = cd.aggNew.overloadResolve(loc, null, newargs); |
268 allocator = f.isNewDeclaration(); | 268 allocator = f.isNewDeclaration(); |
269 assert(allocator); | 269 assert(allocator); |
270 | 270 |
271 tf = cast(TypeFunction)f.type; | 271 tf = cast(TypeFunction)f.type; |
272 functionArguments(loc, sc, tf, newargs); | 272 functionParameters(loc, sc, tf, newargs); |
273 } | 273 } |
274 else | 274 else |
275 { | 275 { |
276 if (newargs && newargs.dim) | 276 if (newargs && newargs.dim) |
277 error("no allocator for %s", cd.toChars()); | 277 error("no allocator for %s", cd.toChars()); |
297 tf = cast(TypeFunction)f.type; | 297 tf = cast(TypeFunction)f.type; |
298 // type = tf.next; | 298 // type = tf.next; |
299 | 299 |
300 if (!arguments) | 300 if (!arguments) |
301 arguments = new Expressions(); | 301 arguments = new Expressions(); |
302 functionArguments(loc, sc, tf, arguments); | 302 functionParameters(loc, sc, tf, arguments); |
303 } | 303 } |
304 else | 304 else |
305 { | 305 { |
306 if (arguments && arguments.dim) | 306 if (arguments && arguments.dim) |
307 error("no constructor for %s", sd.toChars()); | 307 error("no constructor for %s", sd.toChars()); |
318 f = sd.aggNew.overloadResolve(loc, null, newargs); | 318 f = sd.aggNew.overloadResolve(loc, null, newargs); |
319 allocator = f.isNewDeclaration(); | 319 allocator = f.isNewDeclaration(); |
320 assert(allocator); | 320 assert(allocator); |
321 | 321 |
322 tf = cast(TypeFunction)f.type; | 322 tf = cast(TypeFunction)f.type; |
323 functionArguments(loc, sc, tf, newargs); | 323 functionParameters(loc, sc, tf, newargs); |
324 static if (false) { | 324 static if (false) { |
325 e = new VarExp(loc, f); | 325 e = new VarExp(loc, f); |
326 e = new CallExp(loc, e, newargs); | 326 e = new CallExp(loc, e, newargs); |
327 e = e.semantic(sc); | 327 e = e.semantic(sc); |
328 e.type = type.pointerTo(); | 328 e.type = type.pointerTo(); |