comparison dmd2/clone.c @ 1452:638d16625da2

LDC 2 compiles again.
author Robert Clipsham <robert@octarineparrot.com>
date Sat, 30 May 2009 17:23:32 +0100
parents 356e65836fb5
children
comparison
equal deleted inserted replaced
1423:42bd767ec5a4 1452:638d16625da2
45 for (size_t i = 0; i < fields.dim; i++) 45 for (size_t i = 0; i < fields.dim; i++)
46 { 46 {
47 Dsymbol *s = (Dsymbol *)fields.data[i]; 47 Dsymbol *s = (Dsymbol *)fields.data[i];
48 VarDeclaration *v = s->isVarDeclaration(); 48 VarDeclaration *v = s->isVarDeclaration();
49 assert(v && v->storage_class & STCfield); 49 assert(v && v->storage_class & STCfield);
50 if (v->storage_class & STCref)
51 continue;
50 Type *tv = v->type->toBasetype(); 52 Type *tv = v->type->toBasetype();
51 while (tv->ty == Tsarray) 53 while (tv->ty == Tsarray)
52 { TypeSArray *ta = (TypeSArray *)tv; 54 { TypeSArray *ta = (TypeSArray *)tv;
53 tv = tv->nextOf()->toBasetype(); 55 tv = tv->nextOf()->toBasetype();
54 } 56 }
262 for (size_t i = 0; i < fields.dim; i++) 264 for (size_t i = 0; i < fields.dim; i++)
263 { 265 {
264 Dsymbol *s = (Dsymbol *)fields.data[i]; 266 Dsymbol *s = (Dsymbol *)fields.data[i];
265 VarDeclaration *v = s->isVarDeclaration(); 267 VarDeclaration *v = s->isVarDeclaration();
266 assert(v && v->storage_class & STCfield); 268 assert(v && v->storage_class & STCfield);
269 if (v->storage_class & STCref)
270 continue;
267 Type *tv = v->type->toBasetype(); 271 Type *tv = v->type->toBasetype();
268 size_t dim = 1; 272 size_t dim = 1;
269 while (tv->ty == Tsarray) 273 while (tv->ty == Tsarray)
270 { TypeSArray *ta = (TypeSArray *)tv; 274 { TypeSArray *ta = (TypeSArray *)tv;
271 dim *= ((TypeSArray *)tv)->dim->toInteger(); 275 dim *= ((TypeSArray *)tv)->dim->toInteger();
280 // this.v 284 // this.v
281 ex = new ThisExp(0); 285 ex = new ThisExp(0);
282 ex = new DotVarExp(0, ex, v, 0); 286 ex = new DotVarExp(0, ex, v, 0);
283 287
284 if (dim == 1) 288 if (dim == 1)
285 { // this.v.dtor() 289 { // this.v.postblit()
286 ex = new DotVarExp(0, ex, sd->postblit, 0); 290 ex = new DotVarExp(0, ex, sd->postblit, 0);
287 ex = new CallExp(0, ex); 291 ex = new CallExp(0, ex);
288 } 292 }
289 else 293 else
290 { 294 {
306 */ 310 */
307 if (e) 311 if (e)
308 { //printf("Building __fieldPostBlit()\n"); 312 { //printf("Building __fieldPostBlit()\n");
309 PostBlitDeclaration *dd = new PostBlitDeclaration(0, 0, Lexer::idPool("__fieldPostBlit")); 313 PostBlitDeclaration *dd = new PostBlitDeclaration(0, 0, Lexer::idPool("__fieldPostBlit"));
310 dd->fbody = new ExpStatement(0, e); 314 dd->fbody = new ExpStatement(0, e);
311 dtors.push(dd); 315 postblits.shift(dd);
312 members->push(dd); 316 members->push(dd);
313 dd->semantic(sc); 317 dd->semantic(sc);
314 } 318 }
315 319
316 switch (postblits.dim) 320 switch (postblits.dim)
357 for (size_t i = 0; i < fields.dim; i++) 361 for (size_t i = 0; i < fields.dim; i++)
358 { 362 {
359 Dsymbol *s = (Dsymbol *)fields.data[i]; 363 Dsymbol *s = (Dsymbol *)fields.data[i];
360 VarDeclaration *v = s->isVarDeclaration(); 364 VarDeclaration *v = s->isVarDeclaration();
361 assert(v && v->storage_class & STCfield); 365 assert(v && v->storage_class & STCfield);
366 if (v->storage_class & STCref)
367 continue;
362 Type *tv = v->type->toBasetype(); 368 Type *tv = v->type->toBasetype();
363 size_t dim = 1; 369 size_t dim = 1;
364 while (tv->ty == Tsarray) 370 while (tv->ty == Tsarray)
365 { TypeSArray *ta = (TypeSArray *)tv; 371 { TypeSArray *ta = (TypeSArray *)tv;
366 dim *= ((TypeSArray *)tv)->dim->toInteger(); 372 dim *= ((TypeSArray *)tv)->dim->toInteger();