diff dmd/mtype.c @ 875:330f999ade44

Merged DMD 1.038
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 06 Jan 2009 16:33:51 +0100
parents aa953cc960b6
children 1c2faa8325d1
line wrap: on
line diff
--- a/dmd/mtype.c	Tue Jan 06 15:54:48 2009 +0100
+++ b/dmd/mtype.c	Tue Jan 06 16:33:51 2009 +0100
@@ -3721,6 +3721,34 @@
     return t;
 }
 
+Dsymbol *TypeInstance::toDsymbol(Scope *sc)
+{
+    Type *t;
+    Expression *e;
+    Dsymbol *s;
+
+    //printf("TypeInstance::semantic(%s)\n", toChars());
+
+    if (sc->parameterSpecialization)
+    {
+	unsigned errors = global.errors;
+	global.gag++;
+
+	resolve(loc, sc, &e, &t, &s);
+
+	global.gag--;
+	if (errors != global.errors)
+	{   if (global.gag == 0)
+		global.errors = errors;
+	    return NULL;
+	}
+    }
+    else
+	resolve(loc, sc, &e, &t, &s);
+
+    return s;
+}
+
 
 /***************************** TypeTypeof *****************************/
 
@@ -4380,9 +4408,12 @@
 	return new IntegerExp(e->loc, 0, Type::tint32);
     }
 
+    /* If e.tupleof
+     */
     if (ident == Id::tupleof)
     {
-	/* Create a TupleExp
+	/* Create a TupleExp out of the fields of the struct e:
+	 * (e.field0, e.field1, e.field2, ...)
 	 */
 	e = e->semantic(sc);	// do this before turning on noaccesscheck
 	Expressions *exps = new Expressions;
@@ -4477,6 +4508,14 @@
 	return de;
     }
 
+    Import *timp = s->isImport();
+    if (timp)
+    {
+	e = new DsymbolExp(e->loc, s);
+	e = e->semantic(sc);
+	return e;
+    }
+
     d = s->isDeclaration();
 #ifdef DEBUG
     if (!d)
@@ -4521,9 +4560,7 @@
 
 	// *(&e + offset)
 	accessCheck(e->loc, sc, e, d);
-
-// LDC we don't want dot exprs turned into pointer arithmetic. it complicates things for no apparent gain
-#ifndef IN_LLVM
+#if 0
 	b = new AddrExp(e->loc, e);
 	b->type = e->type->pointerTo();
 	b = new AddExp(e->loc, b, new IntegerExp(e->loc, v->offset, Type::tint32));