diff 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
line wrap: on
line diff
--- a/dmd2/inline.c	Sat Dec 13 13:15:31 2008 +0100
+++ b/dmd2/inline.c	Sat Dec 13 16:14:37 2008 +0100
@@ -1,5 +1,5 @@
 
-// Copyright (c) 1999-2007 by Digital Mars
+// Copyright (c) 1999-2008 by Digital Mars
 // All Rights Reserved
 // written by Walter Bright
 // http://www.digitalmars.com
@@ -565,9 +565,9 @@
 		}
 		else
 		{
-		    ExpInitializer *ie = vd->init->isExpInitializer();
-		    assert(ie);
-		    vto->init = new ExpInitializer(ie->loc, ie->exp->doInline(ids));
+		    Expression *e = vd->init->toExpression();
+		    assert(e);
+		    vto->init = new ExpInitializer(e->loc, e->doInline(ids));
 		}
 	    }
 	    de->declaration = (Dsymbol *) (void *)vto;
@@ -1368,6 +1368,20 @@
 	ExpInitializer *ei;
 	VarExp *ve;
 
+#if STRUCTTHISREF
+	if (ethis->type->ty == Tpointer)
+	{   Type *t = ethis->type->nextOf();
+	    ethis = new PtrExp(ethis->loc, ethis);
+	    ethis->type = t;
+	}
+	ei = new ExpInitializer(ethis->loc, ethis);
+
+	vthis = new VarDeclaration(ethis->loc, ethis->type, Id::This, ei);
+	if (ethis->type->ty != Tclass)
+	    vthis->storage_class = STCref;
+	else
+	    vthis->storage_class = STCin;
+#else
 	if (ethis->type->ty != Tclass && ethis->type->ty != Tpointer)
 	{
 	    ethis = ethis->addressOf(NULL);
@@ -1377,6 +1391,7 @@
 
 	vthis = new VarDeclaration(ethis->loc, ethis->type, Id::This, ei);
 	vthis->storage_class = STCin;
+#endif
 	vthis->linkage = LINKd;
 	vthis->parent = iss->fd;
 
@@ -1385,6 +1400,13 @@
 
 	ei->exp = new AssignExp(vthis->loc, ve, ethis);
 	ei->exp->type = ve->type;
+#if STRUCTTHISREF
+	if (ethis->type->ty != Tclass)
+	{   /* This is a reference initialization, not a simple assignment.
+	     */
+	    ei->exp->op = TOKconstruct;
+	}
+#endif
 
 	ids.vthis = vthis;
     }