diff dmd/DotVarExp.d @ 123:9e39c7de8438

Make dmd test suite compile
author korDen
date Fri, 03 Sep 2010 20:46:58 +0400
parents e28b18c23469
children af1bebfd96a4
line wrap: on
line diff
--- a/dmd/DotVarExp.d	Thu Sep 02 23:37:49 2010 +0100
+++ b/dmd/DotVarExp.d	Fri Sep 03 20:46:58 2010 +0400
@@ -225,7 +225,36 @@
 
 	override Expression interpret(InterState istate)
 	{
-		assert(false);
+		Expression e = EXP_CANT_INTERPRET;
+
+version (LOG) {
+		printf("DotVarExp.interpret() %.*s\n", toChars());
+}
+
+		Expression ex = e1.interpret(istate);
+		if (ex !is EXP_CANT_INTERPRET)
+		{
+			if (ex.op == TOKstructliteral)
+			{   
+				StructLiteralExp se = cast(StructLiteralExp)ex;
+				VarDeclaration v = var.isVarDeclaration();
+				if (v)
+				{	
+					e = se.getField(type, v.offset);
+					if (!e)
+						e = EXP_CANT_INTERPRET;
+					return e;
+				}
+			} else {
+				error("%s.%s is not yet implemented at compile time", ex.toChars(), var.toChars());
+			}
+		}
+
+version (LOG) {
+		if (e is EXP_CANT_INTERPRET)
+			printf("DotVarExp.interpret() %.*s = EXP_CANT_INTERPRET\n", toChars());
+}
+		return e;
 	}
 
 	override void toCBuffer(OutBuffer buf, HdrGenState* hgs)