summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-10 15:19:06 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-10 15:19:06 -0400
commit0c1f369955bcdfe949bb6793812ef8ead2963228 (patch)
tree00f08400cf61ad8bb9241c337719fe98f0348eb9 /src/monoize.sml
parent81a4a8171274586428288bd7e75ea6721ca56e27 (diff)
Stringifying attributes
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index ab344a16..0b868d59 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -79,6 +79,15 @@ fun monoType env (all as (c, loc)) =
val dummyExp = (L'.EPrim (Prim.Int 0), E.dummySpan)
+fun attrifyExp (e, tAll as (t, loc)) =
+ case t of
+ L'.TFfi ("Basis", "string") => e
+ | L'.TFfi ("Basis", "int") => (L'.EFfiApp ("Basis", "attrifyInt", [e]), loc)
+ | L'.TFfi ("Basis", "float") => (L'.EFfiApp ("Basis", "attrifyFloat", [e]), loc)
+ | _ => (E.errorAt loc "Don't know how to encode attribute type";
+ Print.eprefaces' [("Type", MonoPrint.p_typ MonoEnv.empty tAll)];
+ dummyExp)
+
fun monoExp env (all as (e, loc)) =
let
fun poly () =
@@ -140,13 +149,13 @@ fun monoExp env (all as (e, loc)) =
val s = (L'.EPrim (Prim.String (String.concat ["<", tag])), loc)
in
- foldl (fn ((x, e, _), s) =>
+ foldl (fn ((x, e, t), s) =>
let
val xp = " " ^ lowercaseFirst x ^ "=\""
in
(L'.EStrcat (s,
(L'.EStrcat ((L'.EPrim (Prim.String xp), loc),
- (L'.EStrcat (e,
+ (L'.EStrcat (attrifyExp (e, t),
(L'.EPrim (Prim.String "\""), loc)),
loc)),
loc)), loc)