summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--6/simp.c3
-rwxr-xr-xtest/runtest.sh1
-rw-r--r--test/tests1
-rw-r--r--test/voideffect.myr13
4 files changed, 16 insertions, 2 deletions
diff --git a/6/simp.c b/6/simp.c
index d3505b9..1b21ed7 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1638,9 +1638,10 @@ static Node *rval(Simp *s, Node *n, Node *dst)
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);
}
}
diff --git a/test/runtest.sh b/test/runtest.sh
index da8ca39..538027b 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -42,7 +42,6 @@ function expectprint {
fi
}
-
function expectcompare {
if [ x"" != x"$TMPDIR" ]; then
t=$TMPDIR/myrtest-$1-$RANDOM
diff --git a/test/tests b/test/tests
index 8dc684f..3a69408 100644
--- a/test/tests
+++ b/test/tests
@@ -148,3 +148,4 @@ F generic-in-const
F aritylow
F arityhigh
F badop
+B voideffect P pass
diff --git a/test/voideffect.myr b/test/voideffect.myr
new file mode 100644
index 0000000..c570b02
--- /dev/null
+++ b/test/voideffect.myr
@@ -0,0 +1,13 @@
+use std
+
+const bar = {
+ std.put("pass")
+}
+
+const foo = {
+ -> bar()
+}
+
+const main = {
+ foo()
+}