summaryrefslogtreecommitdiff
path: root/src/jscomp.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-01 16:11:42 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-01 16:11:42 -0500
commitd25c65412f60bc8e5626b4d8bcdc204281af385b (patch)
tree80d53bab75fbe437b17753868f154b870721d15b /src/jscomp.sml
parenta78c673483adad1493f098965ad7802f8f42759e (diff)
Injecting strings and bools
Diffstat (limited to 'src/jscomp.sml')
-rw-r--r--src/jscomp.sml16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml
index ca6508a9..d7017a47 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -162,10 +162,24 @@ fun process file =
(EFfiApp ("Basis", "htmlifyInt", [e]), loc)]
| TRecord [] => str loc "null"
- | TFfi ("Basis", "string") => e
+ | TFfi ("Basis", "string") => (EFfiApp ("Basis", "jsifyString", [e]), loc)
| TFfi ("Basis", "int") => (EFfiApp ("Basis", "htmlifyInt", [e]), loc)
| TFfi ("Basis", "float") => (EFfiApp ("Basis", "htmlifyFloat", [e]), loc)
+ | TFfi ("Basis", "bool") => (ECase (e,
+ [((PCon (Enum, PConFfi {mod = "Basis",
+ datatyp = "bool",
+ con = "True",
+ arg = NONE}, NONE), loc),
+ str loc "true"),
+ ((PCon (Enum, PConFfi {mod = "Basis",
+ datatyp = "bool",
+ con = "False",
+ arg = NONE}, NONE), loc),
+ str loc "false")],
+ {disc = (TFfi ("Basis", "bool"), loc),
+ result = (TFfi ("Basis", "string"), loc)}), loc)
+
| _ => (EM.errorAt loc "Don't know how to embed type in JavaScript";
Print.prefaces "Can't embed" [("t", MonoPrint.p_typ MonoEnv.empty t)];
str loc "ERROR")