diff dmd/ShrAssignExp.d @ 130:60bb0fe4563e

dmdfe 2.037 first main iteration
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Thu, 09 Sep 2010 22:51:44 +0100
parents fe941d774f4a
children 206db751bd4c
line wrap: on
line diff
--- a/dmd/ShrAssignExp.d	Sun Sep 05 15:32:22 2010 +0400
+++ b/dmd/ShrAssignExp.d	Thu Sep 09 22:51:44 2010 +0100
@@ -36,6 +36,13 @@
 		if (e)
 			return e;
 
+        if (e1.op == TOK.TOKarraylength)
+        {
+	        e = ArrayLengthExp.rewriteOpAssign(this);
+	        e = e.semantic(sc);
+	        return e;
+        }
+        
 		e1 = e1.modifiableLvalue(sc, e1);
 		e1.checkScalar();
 		e1.checkNoBool();
@@ -60,6 +67,15 @@
 
     override elem* toElem(IRState* irs)
 	{
-		return toElemBin(irs, OPshrass);
+	    //printf("ShrAssignExp::toElem() %s, %s\n", e1->type->toChars(), e1->toChars());
+		Type t1 = e1.type;
+		if (e1.op == TOK.TOKcast)
+		{
+			// Use the type before it was integrally promoted to int
+			auto ce = cast(CastExp)e1;
+			t1 = ce.e1.type;
+		}
+		return toElemBin(irs, t1.isunsigned() ? OPER.OPshrass : OPER.OPashrass);
+
 	}
 }