ref: 47a1698fb7fca807f6fa6ef87d39a3a46e337dd2
parent: c895d869daf0531f5fb1df182ebc92898d0bae99
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Nov 4 18:08:57 EST 2014
Make all matches exhaustive. The language now requires it.
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
MYRBIN=mbld
+
MYRSRC= \
build.myr \
clean.myr \
--- a/deps.myr
+++ b/deps.myr
@@ -211,6 +211,8 @@
match bio.open(path, bio.Rd)
| `std.Some file:
-> file
+ | `std.None:
+ /* nothing */
;;
;;
path = std.pathjoin([opt_instroot, "/lib/myr", lib][:])
@@ -217,6 +219,8 @@
match bio.open(path, bio.Rd)
| `std.Some file:
-> file
+ | `std.None:
+ /* nothing */
;;
std.fatal(1, "could not find library %s in %s\n", lib, path)
}
@@ -234,6 +238,8 @@
else
deps = std.slpush(deps, `Lib std.sldup(uses[4]))
;;
+ | `std.None:
+ /* nothing to do */
;;
-> deps
}
@@ -243,10 +249,10 @@
const pushdep = {dg, src, dst
var sl
- std.assert(dst.len < 20, "BUG!")
if opt_debug
std.put("%s <= %s\n", dst, src)
;;
+ std.assert(dst.len < 200, "BUG!")
sl = std.htgetv(dg.deps, dst, [][:])
sl = std.slpush(sl, src)
std.htput(dg.deps, dst, sl)
--- a/main.myr
+++ b/main.myr
@@ -39,7 +39,8 @@
| ('A', arg): bld.opt_as = arg
| ('M', arg): bld.opt_muse = arg
| ('L', arg): bld.opt_ld = arg
- | ('R', arg): bld.opt_ar = arg
+ | ('D', arg): bld.opt_ar = arg
+ | _: std.die("got invalid arg\n")
;;
;;
--- a/util.myr
+++ b/util.myr
@@ -33,6 +33,8 @@
else
std.waitpid(pid, &status, 0)
;;
+
+:retry
match std.waitstatus(status)
| `std.Waitexit estatus:
if estatus != 0
@@ -40,6 +42,9 @@
;;
| `std.Waitsig sig:
std.fatal(1, "%s exited with signal %i\n", cmd[0], sig)
+ | `std.Waitstop sig:
+ std.fatal(1, "%s paused with signal %i\n", cmd[0], sig)
+ goto retry
;;
}
@@ -63,6 +68,8 @@
| `std.Some i:
suff = src[i:]
src = src[:i]
+ | `std.None:
+ /* no suffix to trim */
;;
match std.strrfind(src, "+")
@@ -69,6 +76,8 @@
| `std.Some i:
platf = src[i:]
src = src[:i]
+ | `std.None:
+ /* no platform to trim */
;;
-> (src, platf, suff)
}