diff options
author | Adam Chlipala <adam@chlipala.net> | 2016-01-02 10:43:51 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2016-01-02 10:43:51 -0500 |
commit | aa3e615e84e3e8844fd5537ef84c38d5d18298ab (patch) | |
tree | c74ed84469b2abda5ea7c0763761da83a1d1ebfd /src | |
parent | c748c02510ce84b457c2c7d288a67b686642bd0d (diff) |
Finishing the last change in final handling of enumerated types
Diffstat (limited to 'src')
-rw-r--r-- | src/cjr_print.sml | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index ee7792a5..bbbe5c8b 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -2603,18 +2603,19 @@ fun p_file env (ds, ps) = global_initializers := []) (* First, pull out all of the enumerated types, to be declared first. *) - val (ds, enums) = ListUtil.foldlMap (fn (d, enums) => - case #1 d of - DDatatype dts => - let - val (enum, other) = List.partition (fn (Enum, _, _, _) => true - | _ => false) dts - in - ((DDatatype other, #2 d), - List.revAppend (enum, enums)) - end - | _ => (d, enums)) - [] ds + val (ds, enums) = ListUtil.foldlMapPartial (fn (d, enums) => + case #1 d of + DDatatype dts => + let + val (enum, other) = List.partition (fn (Enum, _, _, _) => true + | _ => false) dts + in + (SOME (DDatatype other, #2 d), + List.revAppend (enum, enums)) + end + | DDatatypeForward (Enum, _, _) => (NONE, enums) + | _ => (SOME d, enums)) + [] ds val ds = (DDatatype enums, ErrorMsg.dummySpan) :: ds |