Mercurial > urweb
diff src/elaborate.sml @ 2010:403f0cc65b9c
New lessSafeFfi
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 02 May 2014 19:19:09 -0400 |
parents | 799be3911ce3 |
children | e762c96fffb7 |
line wrap: on
line diff
--- a/src/elaborate.sml Fri May 02 17:16:02 2014 -0400 +++ b/src/elaborate.sml Fri May 02 19:19:09 2014 -0400 @@ -2999,6 +2999,7 @@ | L'.DTask _ => [] | L'.DPolicy _ => [] | L'.DOnError _ => [] + | L'.DFfi (x, n, _, t) => [(L'.SgiVal (x, n, t), loc)] and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) = ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), @@ -4298,6 +4299,20 @@ ([(L'.DOnError (n, ms, s), loc)], (env, denv, gs)) end) + | L.DFfi (x, modes, t) => + let + val () = if Settings.getLessSafeFfi () then + () + else + ErrorMsg.errorAt loc "To enable 'ffi' declarations, the .urp directive 'lessSafeFfi' is mandatory." + + val (t', _, gs1) = elabCon (env, denv) t + val t' = normClassConstraint env t' + val (env', n) = E.pushENamed env x t' + in + ([(L'.DFfi (x, n, modes, t'), loc)], (env', denv, enD gs1 @ gs)) + end + (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) in (*prefaces "/elabDecl" [("d", SourcePrint.p_decl dAll),