summaryrefslogtreecommitdiff
path: root/src/cjr_env.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-16 16:02:17 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-16 16:02:17 -0400
commitda833d17ddc403e4cba138ddd0dde85bb03100f5 (patch)
treedf44fd4952ee16f262cce3e4a063352e534aee25 /src/cjr_env.sml
parentac6a31d08025c413f89961a17b35321be8a41fc7 (diff)
Mutual datatypes through Cjrize
Diffstat (limited to 'src/cjr_env.sml')
-rw-r--r--src/cjr_env.sml19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/cjr_env.sml b/src/cjr_env.sml
index 54dbea17..217efb3a 100644
--- a/src/cjr_env.sml
+++ b/src/cjr_env.sml
@@ -137,15 +137,16 @@ fun classifyDatatype xncs =
fun declBinds env (d, loc) =
case d of
- DDatatype (_, x, n, xncs) =>
- let
- val env = pushDatatype env x n xncs
- val dt = (TDatatype (classifyDatatype xncs, n, ref xncs), loc)
- in
- foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt
- | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc))
- env xncs
- end
+ DDatatype dts =>
+ foldl (fn ((_, x, n, xncs), env) =>
+ let
+ val env = pushDatatype env x n xncs
+ val dt = (TDatatype (classifyDatatype xncs, n, ref xncs), loc)
+ in
+ foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt
+ | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc))
+ env xncs
+ end) env dts
| DDatatypeForward (_, x, n) => pushDatatype env x n []
| DStruct (n, xts) => pushStruct env n xts
| DVal (x, n, t, _) => pushENamed env x n t