diff dmd/StructLiteralExp.d @ 109:ceda59b4d255

expression.c changes, now only ddoc should be left
author Trass3r
date Tue, 31 Aug 2010 22:08:52 +0200
parents 39648eb578f6
children e28b18c23469
line wrap: on
line diff
--- a/dmd/StructLiteralExp.d	Tue Aug 31 21:41:01 2010 +0200
+++ b/dmd/StructLiteralExp.d	Tue Aug 31 22:08:52 2010 +0200
@@ -20,6 +20,7 @@
 import dmd.OutBuffer;
 import dmd.Loc;
 import dmd.Scope;
+import dmd.Initializer;
 import dmd.InlineCostState;
 import dmd.IRState;
 import dmd.InlineDoState;
@@ -138,7 +139,18 @@
 				{   
 					e = v.init.toExpression();
 					if (!e)
+					{
 						error("cannot make expression out of initializer for %s", v.toChars());
+						e = new ErrorExp();
+					}
+					else if (v.scope_)
+					{
+						// Do deferred semantic anaylsis
+						Initializer i2 = v.init.syntaxCopy();
+						i2 = i2.semantic(v.scope_, v.type);
+						e = i2.toExpression();
+						v.scope_ = null;
+					}
 				}
 				else
 				{	
@@ -154,6 +166,10 @@
 		return this;
 	}
 
+	/**************************************
+	 * Gets expression at offset of type.
+	 * Returns null if not found.
+	 */
 	Expression getField(Type type, uint offset)
 	{
 		//printf("StructLiteralExp.getField(this = %s, type = %s, offset = %u)\n",