diff dmd/ScopeDsymbol.d @ 79:43073c7c7769

updated to 2.035 also implemented a few missing functions still crashes in Import.importAll though
author Trass3r
date Mon, 30 Aug 2010 03:57:51 +0200
parents ad4792a1cfd6
children e28b18c23469
line wrap: on
line diff
--- a/dmd/ScopeDsymbol.d	Sun Aug 29 14:39:08 2010 +0100
+++ b/dmd/ScopeDsymbol.d	Mon Aug 30 03:57:51 2010 +0200
@@ -15,7 +15,8 @@
 import dmd.Id;
 import dmd.expression.Util;
 
-import core.stdc.stdlib;
+import std.stdio : writef;
+//core.stdc.stdlib;
 import core.memory;
 
 class ScopeDsymbol : Dsymbol
@@ -56,7 +57,7 @@
 
 		// Look in symbols declared in this module
 		Dsymbol s = symtab ? symtab.lookup(ident) : null;
-		
+		// writef("\ts = %p, imports = %p, %d\n", s, imports, imports ? imports->dim : 0);
 		if (s)
 		{
 			//printf("\ts = '%s.%s'\n",toChars(),s.toChars());
@@ -159,10 +160,10 @@
 	
     void importScope(ScopeDsymbol s, PROT protection)
 	{
-		//printf("%s.ScopeDsymbol.importScope(%s, %d)\n", toChars(), s.toChars(), protection);
+		//writef("%s.ScopeDsymbol.importScope(%s, %d)\n", toChars(), s.toChars(), protection);
 
 		// No circular or redundant import's
-		if (s != this)
+		if (s !is this)
 		{
 			if (!imports)
 				imports = new Array();
@@ -187,12 +188,14 @@
 
     override int isforwardRef()
 	{
-		assert(false);
+		return (members is null);
 	}
 	
     override void defineRef(Dsymbol s)
 	{
-		assert(false);
+		ScopeDsymbol ss = s.isScopeDsymbol();
+		members = ss.members;
+		ss.members = null;
 	}
 
     static void multiplyDefined(Loc loc, Dsymbol s1, Dsymbol s2)
@@ -226,6 +229,8 @@
 		assert(false);
 	}
 
+version(DMDV2)
+{
 	/*******************************************
 	 * Look for member of the form:
 	 *	const(MemberInfo)[] getMembers(string);
@@ -259,21 +264,30 @@
 
 		return fdx;
 	}
+}
+
+    Dsymbol symtabInsert(Dsymbol s)
+    {
+    	return symtab.insert(s);
+    }
 
     void emitMemberComments(Scope sc)
 	{
 		assert(false);
 	}
 
+version(DMDV2)
+{
     static size_t dim(Dsymbols members)
 	{
 		assert(false);
 	}
-	
+
+
     static Dsymbol getNth(Dsymbols members, size_t nth, size_t* pn = null)
 	{
 		assert(false);
 	}
-
+}
     override ScopeDsymbol isScopeDsymbol() { return this; }
 }