shithub: mc

Download patch

ref: 8fda8a0adbb44f4e63bb86256d9f56700d79f301
parent: 4c1c6f77962993b62a082bfd2d91bde671cdc329
parent: 3fe8f058c4ae3f84ef931b61ff667ef93dc741ab
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jan 11 13:56:18 EST 2016

Merge pull request #37 from andrewchambers/voideffect

Fix #36 - Emit Oret arg when return type is void

--- a/6/simp.c
+++ b/6/simp.c
@@ -1638,9 +1638,10 @@
 			append(s, v);
 		} else if (n->expr.nargs && n->expr.args[0]) {
 			t = s->ret;
+			u = rval(s, args[0], NULL);
 			/* void calls return nothing */
 			if (t) {
-				t = set(t, rval(s, args[0], NULL));
+				t = set(t, u);
 				append(s, t);
 			}
 		}
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -42,7 +42,6 @@
     fi
 }
 
-
 function expectcompare {
     if [ x"" !=  x"$TMPDIR" ]; then 
         t=$TMPDIR/myrtest-$1-$RANDOM
--- a/test/tests
+++ b/test/tests
@@ -148,3 +148,4 @@
 F aritylow
 F arityhigh
 F badop
+B voideffect	P	pass
--- /dev/null
+++ b/test/voideffect.myr
@@ -1,0 +1,13 @@
+use std
+
+const bar = {
+	std.put("pass")
+}
+
+const foo = {
+	-> bar()
+}
+
+const main = {
+	foo()
+}