summaryrefslogtreecommitdiff
path: root/src/cjrize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 21:19:43 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 21:19:43 -0400
commit047a2f193646e08db526768dca8376b7270eecb5 (patch)
tree2be405017cad5af57826b17c1715d9579eb06d1b /src/cjrize.sml
parent9a22207b565607db64f95dda5fdc1c9e56224ec9 (diff)
Almost have that nested save function compiling
Diffstat (limited to 'src/cjrize.sml')
-rw-r--r--src/cjrize.sml19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cjrize.sml b/src/cjrize.sml
index 05ceb0f9..db2bd48f 100644
--- a/src/cjrize.sml
+++ b/src/cjrize.sml
@@ -39,6 +39,7 @@ structure Sm :> sig
val find : t * (string * L.typ) list * (string * L'.typ) list -> t * int
val declares : t -> (int * (string * L'.typ) list) list
+ val clearDeclares : t -> t
end = struct
structure FM = BinaryMapFn(struct
@@ -61,6 +62,8 @@ fun find ((n, m, ds), xts, xts') =
fun declares (_, _, ds) = ds
+fun clearDeclares (n, m, _) = (n, m, [])
+
end
fun cifyTyp x =
@@ -520,23 +523,25 @@ fun cjrize ds =
val (dsF, ds, ps, sm) = foldl (fn (d, (dsF, ds, ps, sm)) =>
let
val (dop, pop, sm) = cifyDecl (d, sm)
+
val (dsF, ds) = case dop of
NONE => (dsF, ds)
- | SOME (d as (L'.DDatatype (dk, x, n, _), loc)) =>
- ((L'.DDatatypeForward (dk, x, n), loc) :: dsF,
- d :: ds)
+ | SOME (d as (L'.DDatatype _, loc)) =>
+ (d :: dsF, ds)
| SOME d => (dsF, d :: ds)
+
+ val dsF = map (fn v => (L'.DStruct v, ErrorMsg.dummySpan)) (Sm.declares sm)
+ @ dsF
+
val ps = case pop of
NONE => ps
| SOME p => p :: ps
in
- (dsF, ds, ps, sm)
+ (dsF, ds, ps, Sm.clearDeclares sm)
end)
([], [], [], Sm.empty) ds
in
- (List.revAppend (dsF,
- List.revAppend (map (fn v => (L'.DStruct v, ErrorMsg.dummySpan)) (Sm.declares sm),
- rev ds)),
+ (List.revAppend (dsF, rev ds),
ps)
end