comparison dmd2/inline.c @ 847:356e65836fb5

Merged DMD 2.021 frontend. Removed generated files from dmd/dmd2 dirs.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 13 Dec 2008 16:14:37 +0100
parents f04dde6e882c
children 638d16625da2
comparison
equal deleted inserted replaced
846:bc982f1ad106 847:356e65836fb5
1 1
2 // Copyright (c) 1999-2007 by Digital Mars 2 // Copyright (c) 1999-2008 by Digital Mars
3 // All Rights Reserved 3 // All Rights Reserved
4 // written by Walter Bright 4 // written by Walter Bright
5 // http://www.digitalmars.com 5 // http://www.digitalmars.com
6 // License for redistribution is by either the Artistic License 6 // License for redistribution is by either the Artistic License
7 // in artistic.txt, or the GNU General Public License in gnu.txt. 7 // in artistic.txt, or the GNU General Public License in gnu.txt.
563 { 563 {
564 vto->init = new VoidInitializer(vd->init->loc); 564 vto->init = new VoidInitializer(vd->init->loc);
565 } 565 }
566 else 566 else
567 { 567 {
568 ExpInitializer *ie = vd->init->isExpInitializer(); 568 Expression *e = vd->init->toExpression();
569 assert(ie); 569 assert(e);
570 vto->init = new ExpInitializer(ie->loc, ie->exp->doInline(ids)); 570 vto->init = new ExpInitializer(e->loc, e->doInline(ids));
571 } 571 }
572 } 572 }
573 de->declaration = (Dsymbol *) (void *)vto; 573 de->declaration = (Dsymbol *) (void *)vto;
574 } 574 }
575 } 575 }
1366 { 1366 {
1367 VarDeclaration *vthis; 1367 VarDeclaration *vthis;
1368 ExpInitializer *ei; 1368 ExpInitializer *ei;
1369 VarExp *ve; 1369 VarExp *ve;
1370 1370
1371 #if STRUCTTHISREF
1372 if (ethis->type->ty == Tpointer)
1373 { Type *t = ethis->type->nextOf();
1374 ethis = new PtrExp(ethis->loc, ethis);
1375 ethis->type = t;
1376 }
1377 ei = new ExpInitializer(ethis->loc, ethis);
1378
1379 vthis = new VarDeclaration(ethis->loc, ethis->type, Id::This, ei);
1380 if (ethis->type->ty != Tclass)
1381 vthis->storage_class = STCref;
1382 else
1383 vthis->storage_class = STCin;
1384 #else
1371 if (ethis->type->ty != Tclass && ethis->type->ty != Tpointer) 1385 if (ethis->type->ty != Tclass && ethis->type->ty != Tpointer)
1372 { 1386 {
1373 ethis = ethis->addressOf(NULL); 1387 ethis = ethis->addressOf(NULL);
1374 } 1388 }
1375 1389
1376 ei = new ExpInitializer(ethis->loc, ethis); 1390 ei = new ExpInitializer(ethis->loc, ethis);
1377 1391
1378 vthis = new VarDeclaration(ethis->loc, ethis->type, Id::This, ei); 1392 vthis = new VarDeclaration(ethis->loc, ethis->type, Id::This, ei);
1379 vthis->storage_class = STCin; 1393 vthis->storage_class = STCin;
1394 #endif
1380 vthis->linkage = LINKd; 1395 vthis->linkage = LINKd;
1381 vthis->parent = iss->fd; 1396 vthis->parent = iss->fd;
1382 1397
1383 ve = new VarExp(vthis->loc, vthis); 1398 ve = new VarExp(vthis->loc, vthis);
1384 ve->type = vthis->type; 1399 ve->type = vthis->type;
1385 1400
1386 ei->exp = new AssignExp(vthis->loc, ve, ethis); 1401 ei->exp = new AssignExp(vthis->loc, ve, ethis);
1387 ei->exp->type = ve->type; 1402 ei->exp->type = ve->type;
1403 #if STRUCTTHISREF
1404 if (ethis->type->ty != Tclass)
1405 { /* This is a reference initialization, not a simple assignment.
1406 */
1407 ei->exp->op = TOKconstruct;
1408 }
1409 #endif
1388 1410
1389 ids.vthis = vthis; 1411 ids.vthis = vthis;
1390 } 1412 }
1391 1413
1392 // Set up parameters 1414 // Set up parameters