diff dmd2/class.c @ 1577:e4f7b5d9c68a

DMD 2.032 Merge.
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 10:07:56 +0100
parents 54b3c1394d62
children
line wrap: on
line diff
--- a/dmd2/class.c	Tue Aug 25 21:35:43 2009 +0200
+++ b/dmd2/class.c	Tue Sep 08 10:07:56 2009 +0100
@@ -349,6 +349,8 @@
 		    //printf("\ttry later, forward reference of base class %s\n", tc->sym->toChars());
 		    scope = scx ? scx : new Scope(*sc);
 		    scope->setNoFree();
+		    if (tc->sym->scope)
+		        tc->sym->scope->module->addDeferredSemantic(tc->sym);
 		    scope->module->addDeferredSemantic(this);
 		    return;
 		}
@@ -402,6 +404,12 @@
 		    error("inherits from duplicate interface %s", b2->base->toChars());
 	    }
 
+	    if (!tc->sym->symtab)
+	    {   // Try to resolve forward reference
+		if (sc->mustsemantic && tc->sym->scope)
+		    tc->sym->semantic(NULL);
+	    }
+
 	    b->base = tc->sym;
 	    if (!b->base->symtab || b->base->scope)
 	    {
@@ -410,6 +418,8 @@
 		//printf("\ttry later, forward reference of base %s\n", baseClass->toChars());
 		scope = scx ? scx : new Scope(*sc);
 		scope->setNoFree();
+		if (tc->sym->scope)
+		    tc->sym->scope->module->addDeferredSemantic(tc->sym);
 		scope->module->addDeferredSemantic(this);
 		return;
 	    }
@@ -798,8 +808,8 @@
 Dsymbol *ClassDeclaration::search(Loc loc, Identifier *ident, int flags)
 {
     Dsymbol *s;
+    //printf("%s.ClassDeclaration::search('%s')\n", toChars(), ident->toChars());
 
-    //printf("%s.ClassDeclaration::search('%s')\n", toChars(), ident->toChars());
     if (scope)
     {	Scope *sc = scope;
 	sc->mustsemantic++;
@@ -962,10 +972,12 @@
     return 0;
 }
 
+#if DMDV2
 int ClassDeclaration::isCPPinterface()
 {
     return 0;
 }
+#endif
 
 
 /****************************************
@@ -1142,6 +1154,11 @@
 		baseclasses.remove(i);
 		continue;
 	    }
+	    if (!b->base->symtab)
+	    {   // Try to resolve forward reference
+		if (sc->mustsemantic && b->base->scope)
+		    b->base->semantic(NULL);
+	    }
 	    if (!b->base->symtab || b->base->scope || b->base->inuse)
 	    {
 		//error("forward reference of base class %s", baseClass->toChars());
@@ -1326,10 +1343,12 @@
     return com;
 }
 
+#if DMDV2
 int InterfaceDeclaration::isCPPinterface()
 {
     return cpp;
 }
+#endif
 
 /*******************************************
  */