summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-06-07 11:13:18 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-06-07 11:13:18 -0400
commit6994a00f608335fc2e835538dfd84b70aa486d0f (patch)
tree025a2cfb12b5075c231a663b21c6df3b979848ef /src
parent555b6a066f6a4a2396ead20e673b363c3706e713 (diff)
Start of Option; Basis.current; fix missed cases in Jscomp.isNullable
Diffstat (limited to 'src')
-rw-r--r--src/jscomp.sml2
-rw-r--r--src/mono_print.sml9
-rw-r--r--src/monoize.sml12
-rw-r--r--src/settings.sml2
4 files changed, 23 insertions, 2 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml
index b66cdaf2..75cca425 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -194,6 +194,8 @@ fun process file =
fun isNullable (t, _) =
case t of
TOption _ => true
+ | TList _ => true
+ | TDatatype (_, ref (Option, _)) => true
| TRecord [] => true
| _ => false
diff --git a/src/mono_print.sml b/src/mono_print.sml
index ae11d3b8..71bc734a 100644
--- a/src/mono_print.sml
+++ b/src/mono_print.sml
@@ -55,9 +55,14 @@ fun p_typ' par env (t, _) =
space,
p_typ env t]) xcs,
string "}"]
- | TDatatype (n, _) =>
+ | TDatatype (n, ref (dk, _)) =>
((if !debug then
- string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n)
+ string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n ^ "["
+ ^ (case dk of
+ Option => "Option"
+ | Enum => "Enum"
+ | Default => "Default")
+ ^ "]")
else
string (#1 (E.lookupDatatype env n)))
handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n))
diff --git a/src/monoize.sml b/src/monoize.sml
index 9654fd53..bdc8ef82 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1245,6 +1245,18 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
loc)), loc)), loc),
fm)
end
+ | L.ECApp ((L.EFfi ("Basis", "current"), _), t) =>
+ let
+ val t = monoType env t
+ in
+ ((L'.EAbs ("src", (L'.TSource, loc),
+ (L'.TFun ((L'.TRecord [], loc), t), loc),
+ (L'.EAbs ("_", (L'.TRecord [], loc), t,
+ (L'.EFfiApp ("Basis", "current",
+ [(L'.ERel 1, loc)]),
+ loc)), loc)), loc),
+ fm)
+ end
| L.EFfiApp ("Basis", "spawn", [e]) =>
let
diff --git a/src/settings.sml b/src/settings.sml
index e5b42abc..b1c5948f 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -98,6 +98,7 @@ fun isEffectful x = S.member (!effectful, x)
val clientBase = basis ["get",
"set",
+ "current",
"alert",
"recv",
"sleep",
@@ -125,6 +126,7 @@ val basisM = foldl (fn ((k, v : string), m) => M.insert (m, ("Basis", k), v)) M.
val jsFuncsBase = basisM [("alert", "alert"),
("get_client_source", "sg"),
+ ("current", "scur"),
("htmlifyBool", "bs"),
("htmlifyFloat", "ts"),
("htmlifyInt", "ts"),