From 023d9ecbbc2bd1fc14098e84f5b0216da12a48a0 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 20 Feb 2014 10:48:17 -0500 Subject: Fixed issue with datatype constructors inside functors; now on to some problem with modules inside functors --- src/corify.sml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/corify.sml') diff --git a/src/corify.sml b/src/corify.sml index 7fda1034..085b2eb8 100644 --- a/src/corify.sml +++ b/src/corify.sml @@ -99,6 +99,7 @@ structure St : sig val lookupConstructorByNameOpt : t -> string -> L'.patCon option val lookupConstructorByName : t -> string -> L'.patCon val lookupConstructorById : t -> int -> L'.patCon + val lookupConstructorByIdOpt : t -> int -> L'.patCon option datatype core_val = ENormal of int @@ -320,6 +321,9 @@ fun lookupConstructorById ({constructors, ...} : t) n = NONE => raise Fail "Corify.St.lookupConstructorById" | SOME x => x +fun lookupConstructorByIdOpt ({constructors, ...} : t) n = + IM.find (constructors, n) + fun lookupConstructorByNameOpt ({current, ...} : t) x = case current of FFfi {mod = m, constructors, ...} => @@ -744,6 +748,18 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) = in ((L'.DCon (x, n, k', cBase), loc) :: cds, st) end + | L.DVal (x, n, t, e as (L.ENamed n', _)) => + let + val st = + case St.lookupConstructorByIdOpt st n' of + SOME pc => St.bindConstructorAs st x n pc + | _ => st + + val (st, n) = St.bindVal st x n + val s = doRestify Settings.Url (mods, x) + in + ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st) + end | L.DVal (x, n, t, e) => let val (st, n) = St.bindVal st x n -- cgit v1.2.3