summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-03-28 10:37:49 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-03-28 10:37:49 -0400
commit039b577f61a2bdf98abe10c5f10c8e3539a59d19 (patch)
treeaa345d555a5a355451eb600cc3d8bcec5bfb9514
parent9d944623ffa77af076486fd0f9550a1eaf64db33 (diff)
To generate server-side source JavaScript, try both the old and new strategies; remove an unsound optimization from MonoOpt and make MonoReduce work harder to compensate
-rw-r--r--src/jscomp.sml10
-rw-r--r--src/mono_opt.sml16
-rw-r--r--src/mono_reduce.sml3
3 files changed, 9 insertions, 20 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 9321b9ce..ce64c11b 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -1194,10 +1194,12 @@ fun process file =
in
((ELet ("x", t, e', x'), loc), st)
end
- handle CantEmbed t => ((*ErrorMsg.errorAt loc "Unable to embed type in JavaScript";
- Print.preface ("Type",
- MonoPrint.p_typ MonoEnv.empty t);*)
- (e, st)))
+ handle CantEmbed _ =>
+ (jsExp m outer (e', st)
+ handle CantEmbed t => ((*ErrorMsg.errorAt loc "Unable to embed type in JavaScript";
+ Print.preface ("Type",
+ MonoPrint.p_typ MonoEnv.empty t);*)
+ (e, st))))
| EJavaScript (m, e') =>
(foundJavaScript := true;
diff --git a/src/mono_opt.sml b/src/mono_opt.sml
index d05e38fd..12a811cb 100644
--- a/src/mono_opt.sml
+++ b/src/mono_opt.sml
@@ -357,22 +357,6 @@ fun exp e =
result = ran}), loc)
end
- | ECase (discE, pes, {disc, result = (TFun (dom, ran), loc)}) =>
- let
- fun doBody (p, e) =
- let
- val pb = MonoEnv.patBindsN p
- in
- (EApp (MonoEnv.liftExpInExp pb e, (ERel pb, loc)), loc)
- end
- in
- EAbs ("x", dom, ran,
- (optExp (ECase (MonoEnv.liftExpInExp 0 discE,
- map (fn (p, e) => (p, doBody (p, e))) pes,
- {disc = disc,
- result = ran}), loc), loc))
- end
-
| EWrite (EQuery {exps, tables, state, query,
initial = (EPrim (Prim.String ""), _),
body = (EStrcat ((EPrim (Prim.String s), _),
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml
index 15549175..06075954 100644
--- a/src/mono_reduce.sml
+++ b/src/mono_reduce.sml
@@ -635,6 +635,7 @@ fun reduce file =
fun safe (e, _) =
case e of
EAbs _ => true
+ | EError _ => true
| _ => false
in
if List.all (safe o #2) pes then
@@ -642,6 +643,8 @@ fun reduce file =
(ECase (liftExpInExp 0 e',
map (fn (p, (EAbs (_, _, _, e), _)) =>
(p, swapExpVarsPat (0, patBinds p) e)
+ | (p, (EError (e, (TFun (_, t), _)), loc)) =>
+ (p, (EError (e, t), loc))
| _ => raise Fail "MonoReduce ECase") pes,
{disc = disc, result = result}), loc))
else