shithub: mc

Download patch

ref: 4ea0da6b6c5c6b8c7c3ba3f70b210b647f612ed2
parent: df39695ef7997e8cfb4bb3e00976c4689edb15f5
parent: 22c1d29270da65c64ba4c6420baf011f952c6c12
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 12 13:57:53 EST 2016

Merge pull request #40 from andrewchambers/noemptyret

Require '->' to have an argument

--- a/6/simp.c
+++ b/6/simp.c
@@ -1636,7 +1636,7 @@
 			u = disp(n->loc, size(args[0]));
 			v = mkexpr(n->loc, Oblit, s->ret, t, u, NULL);
 			append(s, v);
-		} else if (n->expr.nargs && n->expr.args[0]) {
+		} else {
 			t = s->ret;
 			u = rval(s, args[0], NULL);
 			/* void calls return nothing */
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -584,7 +584,6 @@
 	;
 
 retexpr : Tret expr {$$ = mkexpr($1->loc, Oret, $2, NULL);}
-	| Tret {$$ = mkexpr($1->loc, Oret, NULL);}
 	| expr
 	;
 
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1520,10 +1520,7 @@
 			*sawret = 1;
 		if (!ret)
 			fatal(n, "returns are not valid near %s", ctxstr(st, n));
-		if (nargs)
-			t = unify(st, n, ret, type(st, args[0]));
-		else
-			t = unify(st, n, mktype(Zloc, Tyvoid), ret);
+		t = unify(st, n, ret, type(st, args[0]));
 		settype(st, n, t);
 		break;
 	case Obreak: