Mercurial > projects > ldc
comparison runtime/internal/genobj.d @ 728:635f91212b78
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo.create.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 26 Oct 2008 14:12:03 +0100 |
parents | eef8ac26c66c |
children | 09b88beffd2d |
comparison
equal
deleted
inserted
replaced
727:eea28bfa8416 | 728:635f91212b78 |
---|---|
46 import tango.stdc.stdlib; // : calloc, realloc, free; | 46 import tango.stdc.stdlib; // : calloc, realloc, free; |
47 import util.string; | 47 import util.string; |
48 debug(PRINTF) import tango.stdc.stdio; // : printf; | 48 debug(PRINTF) import tango.stdc.stdio; // : printf; |
49 | 49 |
50 extern (C) void onOutOfMemoryError(); | 50 extern (C) void onOutOfMemoryError(); |
51 extern (C) Object _d_newclass(ClassInfo ci); | 51 extern (C) Object _d_allocclass(ClassInfo ci); |
52 } | 52 } |
53 | 53 |
54 // NOTE: For some reason, this declaration method doesn't work | 54 // NOTE: For some reason, this declaration method doesn't work |
55 // in this particular file (and this file only). It must | 55 // in this particular file (and this file only). It must |
56 // be a DMD thing. | 56 // be a DMD thing. |
186 */ | 186 */ |
187 Object create() | 187 Object create() |
188 { | 188 { |
189 if (flags & 8 && !defaultConstructor) | 189 if (flags & 8 && !defaultConstructor) |
190 return null; | 190 return null; |
191 Object o = _d_newclass(this); | 191 |
192 Object o = _d_allocclass(this); | |
193 // initialize it | |
194 (cast(byte*) o)[0 .. init.length] = init[]; | |
195 | |
192 if (flags & 8 && defaultConstructor) | 196 if (flags & 8 && defaultConstructor) |
193 { | 197 { |
194 defaultConstructor(o); | 198 defaultConstructor(o); |
195 } | 199 } |
196 return o; | 200 return o; |