comparison dmd/mtype.c @ 103:855adfdb8d38 trunk

[svn r107] Getting .classinfo on a class instance now works (classinfo is stored in vtable)
author lindquist
date Sun, 18 Nov 2007 08:25:07 +0100
parents 027b8d8b71ec
children 288fe1029e1f
comparison
equal deleted inserted replaced
102:027b8d8b71ec 103:855adfdb8d38
4500 e = new VarExp(e->loc, sym->vclassinfo); 4500 e = new VarExp(e->loc, sym->vclassinfo);
4501 e = e->addressOf(sc); 4501 e = e->addressOf(sc);
4502 e->type = t; // do this so we don't get redundant dereference 4502 e->type = t; // do this so we don't get redundant dereference
4503 } 4503 }
4504 else 4504 else
4505 { /* For class objects, the classinfo reference is the first 4505 {
4506 * entry in the vtbl[] 4506 /* For class objects, the classinfo reference is the first
4507 */ 4507 * entry in the vtbl[]
4508 */
4509 #if IN_LLVM
4510
4511 e = e->castTo(sc, t->pointerTo()->pointerTo());
4512 e = new PtrExp(e->loc, e);
4513 e->type = t->pointerTo();
4514 e = new PtrExp(e->loc, e);
4515 e->type = t;
4516 if (sym->isInterfaceDeclaration())
4517 {
4518 assert(0 && "No interfaces yet!");
4519 }
4520
4521 #else
4522
4508 e = new PtrExp(e->loc, e); 4523 e = new PtrExp(e->loc, e);
4509 e->type = t->pointerTo(); 4524 e->type = t->pointerTo();
4510 if (sym->isInterfaceDeclaration()) 4525 if (sym->isInterfaceDeclaration())
4511 { 4526 {
4512 if (sym->isCOMinterface()) 4527 if (sym->isCOMinterface())
4524 e->type = e->type->pointerTo(); 4539 e->type = e->type->pointerTo();
4525 e = new PtrExp(e->loc, e); 4540 e = new PtrExp(e->loc, e);
4526 e->type = t->pointerTo(); 4541 e->type = t->pointerTo();
4527 } 4542 }
4528 e = new PtrExp(e->loc, e, t); 4543 e = new PtrExp(e->loc, e, t);
4544
4545 #endif
4529 } 4546 }
4530 return e; 4547 return e;
4531 } 4548 }
4532 4549
4533 if (ident == Id::typeinfo) 4550 if (ident == Id::typeinfo)