diff dmd/ConditionalStatement.d @ 64:4290d870944a

More fixes
author korDen
date Mon, 23 Aug 2010 20:29:15 +0400
parents 0aa7d1437ada
children 2e2a5c3f943a
line wrap: on
line diff
--- a/dmd/ConditionalStatement.d	Mon Aug 23 16:52:24 2010 +0400
+++ b/dmd/ConditionalStatement.d	Mon Aug 23 20:29:15 2010 +0400
@@ -34,7 +34,22 @@
 	
     Statement semantic(Scope sc)
 	{
-		assert(false);
+		//printf("ConditionalStatement.semantic()\n");
+
+		// If we can short-circuit evaluate the if statement, don't do the
+		// semantic analysis of the skipped code.
+		// This feature allows a limited form of conditional compilation.
+		if (condition.include(sc, null))
+		{
+			ifbody = ifbody.semantic(sc);
+			return ifbody;
+		}
+		else
+		{
+			if (elsebody)
+				elsebody = elsebody.semantic(sc);
+			return elsebody;
+		}
 	}
 	
     Statements flatten(Scope sc)