shithub: mc

Download patch

ref: d0ffb958c7247028223c7e53253249d52a47a324
parent: 21b5fb876c5f1e6188a3a6b0e9e77311f06525f0
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Oct 27 08:25:36 EDT 2016

Allow fused arithmetic ops on floats.

	x += 1.0 should be possible now.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1419,6 +1419,10 @@
 	case Omul: /* @a * @a -> @a */
 	case Odiv: /* @a / @a -> @a */
 	case Oneg: /* -@a -> @a */
+	case Oaddeq:	/* @a += @a -> @a */
+	case Osubeq:	/* @a -= @a -> @a */
+	case Omuleq:	/* @a *= @a -> @a */
+	case Odiveq:	/* @a /= @a -> @a */
 		infersub(st, n, ret, sawret, &isconst);
 		t = type(st, args[0]);
 		constrain(st, n, type(st, args[0]), traittab[Tcnum]);
@@ -1441,10 +1445,6 @@
 	case Opredec:	/* --@a -> @a */
 	case Opostinc:	/* @a++ -> @a */
 	case Opostdec:	/* @a-- -> @a */
-	case Oaddeq:	/* @a += @a -> @a */
-	case Osubeq:	/* @a -= @a -> @a */
-	case Omuleq:	/* @a *= @a -> @a */
-	case Odiveq:	/* @a /= @a -> @a */
 	case Omodeq:	/* @a %= @a -> @a */
 	case Oboreq:	/* @a |= @a -> @a */
 	case Obandeq:	/* @a &= @a -> @a */