diff dmd/TypeQualified.d @ 73:ef02e2e203c2

Updating to dmd2.033
author korDen
date Sat, 28 Aug 2010 19:42:41 +0400
parents 2e2a5c3f943a
children e28b18c23469
line wrap: on
line diff
--- a/dmd/TypeQualified.d	Sat Aug 28 16:19:48 2010 +0200
+++ b/dmd/TypeQualified.d	Sat Aug 28 19:42:41 2010 +0400
@@ -2,6 +2,7 @@
 
 import dmd.Type;
 import dmd.Import;
+import dmd.DsymbolExp;
 import dmd.TypeExp;
 import dmd.DotIdExp;
 import dmd.VarDeclaration;
@@ -139,6 +140,19 @@
 						goto Lerror;
 						goto L3;
 					}
+					else if (v && id == Id.stringof_)
+					{
+						e = new DsymbolExp(loc, s, 0);
+						do
+						{
+							id = cast(Identifier)idents.data[i];
+							e = new DotIdExp(loc, e, id);
+						} while (++i < idents.dim);
+						e = e.semantic(sc);
+						*pe = e;
+						return;
+					}
+					
 					t = s.getType();
 					if (!t && s.isDeclaration())
 						t = s.isDeclaration().type;
@@ -242,20 +256,29 @@
 			{
 				if (t.reliesOnTident())
 				{
-					Scope scx;
-
-					for (scx = sc; 1; scx = scx.enclosing)
+					if (s.scope_)
+						t = t.semantic(loc, s.scope_);
+					else
 					{
-						if (!scx)
-						{   
-							error(loc, "forward reference to '%s'", t.toChars());
-							return;
+						/* Attempt to find correct scope in which to evaluate t.
+						 * Not sure if this is right or not, or if we should just
+						 * give forward reference error if s.scope is not set.
+						 */
+						for (Scope scx = sc; 1; scx = scx.enclosing)
+						{
+							if (!scx)
+							{   
+								error(loc, "forward reference to '%s'", t.toChars());
+								return;
+							}
+							if (scx.scopesym == scopesym)
+							{
+								t = t.semantic(loc, scx);
+								break;
+							}
 						}
-						if (scx.scopesym == scopesym)
-							break;
 					}
-					t = t.semantic(loc, scx);
-					//((TypeIdentifier *)t).resolve(loc, scx, pe, &t, ps);
+
 				}
 			}
 			if (t.ty == TY.Ttuple)