summaryrefslogtreecommitdiff
path: root/appl
diff options
context:
space:
mode:
Diffstat (limited to 'appl')
-rw-r--r--appl/cmd/limbo/com.b8
-rw-r--r--appl/cmd/limbo/gen.b2
2 files changed, 6 insertions, 4 deletions
diff --git a/appl/cmd/limbo/com.b b/appl/cmd/limbo/com.b
index c14cd923..320d209c 100644
--- a/appl/cmd/limbo/com.b
+++ b/appl/cmd/limbo/com.b
@@ -388,10 +388,14 @@ fncom(decl: ref Decl)
scom(n.left);
}
pushblock();
- in := genrawop(src, IRET, nil, nil, nil);
+ valued := decl.ty.tof != tnone;
+ if(valued)
+ in := genrawop(src, IRAISE, nil, nil, nil);
+ else
+ in = genrawop(src, IRET, nil, nil, nil);
popblock();
reach(decl.pc);
- if(in.reach != byte 0 && decl.ty.tof != tnone)
+ if(valued && in.reach != byte 0)
error(src.start, "no return at end of function " + dotconv(decl));
# decl.endpc = lastinst;
if(labdep != 0)
diff --git a/appl/cmd/limbo/gen.b b/appl/cmd/limbo/gen.b
index 10988f48..ab4bb6af 100644
--- a/appl/cmd/limbo/gen.b
+++ b/appl/cmd/limbo/gen.b
@@ -562,8 +562,6 @@ foldbranch(in: ref Inst)
next := in.next;
*in = *b;
in.next = next;
- if(b.op == IRET)
- b.reach = byte 1; # might be default return (TO DO)
continue;
}
foldbranch(in.branch);