summaryrefslogtreecommitdiff
path: root/src/cjrize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 18:53:20 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 18:53:20 -0400
commitf946d43f10e2f78d179db30c3c9ae8dcc10f3c10 (patch)
tree96feb9219e03b0d172f13bf75f747e6f26efdefa /src/cjrize.sml
parent3e65e1558de55a1a47a62690b48159d92a4ed072 (diff)
bool in Basis
Diffstat (limited to 'src/cjrize.sml')
-rw-r--r--src/cjrize.sml32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/cjrize.sml b/src/cjrize.sml
index eedc594e..526a3788 100644
--- a/src/cjrize.sml
+++ b/src/cjrize.sml
@@ -103,10 +103,23 @@ fun cifyTyp ((t, loc), sm) =
val dummye = (L'.EPrim (Prim.Int 0), ErrorMsg.dummySpan)
-fun cifyPatCon pc =
+fun cifyPatCon (pc, sm) =
case pc of
- L.PConVar n => L'.PConVar n
- | L.PConFfi mx => L'.PConFfi mx
+ L.PConVar n => (L'.PConVar n, sm)
+ | L.PConFfi {mod = m, datatyp, con, arg} =>
+ let
+ val (arg, sm) =
+ case arg of
+ NONE => (NONE, sm)
+ | SOME t =>
+ let
+ val (t, sm) = cifyTyp (t, sm)
+ in
+ (SOME t, sm)
+ end
+ in
+ (L'.PConFfi {mod = m, datatyp = datatyp, con = con, arg = arg}, sm)
+ end
fun cifyPat ((p, loc), sm) =
case p of
@@ -118,12 +131,18 @@ fun cifyPat ((p, loc), sm) =
((L'.PVar (x, t), loc), sm)
end
| L.PPrim p => ((L'.PPrim p, loc), sm)
- | L.PCon (pc, NONE) => ((L'.PCon (cifyPatCon pc, NONE), loc), sm)
+ | L.PCon (pc, NONE) =>
+ let
+ val (pc, sm) = cifyPatCon (pc, sm)
+ in
+ ((L'.PCon (pc, NONE), loc), sm)
+ end
| L.PCon (pc, SOME p) =>
let
+ val (pc, sm) = cifyPatCon (pc, sm)
val (p, sm) = cifyPat (p, sm)
in
- ((L'.PCon (cifyPatCon pc, SOME p), loc), sm)
+ ((L'.PCon (pc, SOME p), loc), sm)
end
| L.PRecord xps =>
let
@@ -154,8 +173,9 @@ fun cifyExp ((e, loc), sm) =
in
(SOME e, sm)
end
+ val (pc, sm) = cifyPatCon (pc, sm)
in
- ((L'.ECon (cifyPatCon pc, eo), loc), sm)
+ ((L'.ECon (pc, eo), loc), sm)
end
| L.EFfi mx => ((L'.EFfi mx, loc), sm)
| L.EFfiApp (m, x, es) =>