diff dmd/templates/Util.d @ 13:427f8aa74d28

On the road to make Phobos compilable
author korDen
date Mon, 12 Apr 2010 16:29:33 +0400
parents 89cc05dbdae1
children e28b18c23469
line wrap: on
line diff
--- a/dmd/templates/Util.d	Mon Apr 12 15:13:00 2010 +0400
+++ b/dmd/templates/Util.d	Mon Apr 12 16:29:33 2010 +0400
@@ -3,6 +3,9 @@
 import dmd.Dsymbol;
 import dmd.Type;
 import dmd.Expression;
+import dmd.Loc;
+import dmd.Scope;
+import dmd.WANT;
 
 version (DMDV2) {
 	Object objectSyntaxCopy(Object o)
@@ -20,4 +23,27 @@
 
 		return o;
 	}
+}
+
+Object aliasParameterSemantic(Loc loc, Scope sc, Object o)
+{
+    if (o)
+    {
+		Expression ea = isExpression(o);
+		Type ta = isType(o);
+		if (ta)
+		{   
+			Dsymbol s = ta.toDsymbol(sc);
+			if (s)
+				o = s;
+			else
+				o = ta.semantic(loc, sc);
+		}
+		else if (ea)
+		{
+			ea = ea.semantic(sc);
+			o = ea.optimize(WANTvalue | WANTinterpret);
+		}
+    }
+    return o;
 }
\ No newline at end of file