aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mono_reduce.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-06-02 10:17:52 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2013-06-02 10:17:52 -0400
commit8f7644b962b4423e57c35dd40a68c69c58f8de8e (patch)
tree9c9f3e9b9c5e07e126a5ee219990be1edc54c92a /src/mono_reduce.sml
parente1470fa69ac6c8d2a4e937d29af0200515218f26 (diff)
Tweak to 'let' inlining behavior
Diffstat (limited to 'src/mono_reduce.sml')
-rw-r--r--src/mono_reduce.sml15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml
index 5bac235c..2950b668 100644
--- a/src/mono_reduce.sml
+++ b/src/mono_reduce.sml
@@ -564,16 +564,19 @@ fun reduce (file : file) =
#1 (reduceExp env r)
end
- fun trySub () =
+ fun trySub pure =
((*Print.prefaces "trySub"
[("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan))];*)
case t of
(TFfi ("Basis", "string"), _) => doSub ()
| (TSignal _, _) => e
| _ =>
- case e' of
- (ECase _, _) => e
- | _ => doSub ())
+ if pure then
+ doSub ()
+ else
+ case e' of
+ (ECase _, _) => e
+ | _ => doSub ())
in
if impure env e' then
let
@@ -628,14 +631,14 @@ fun reduce (file : file) =
| _ => false))
andalso countFree 0 0 b = 1
andalso not (freeInAbs b) then
- trySub ()
+ trySub (List.null effs_e')
else
e
end
else if countFree 0 0 b > 1 andalso not (!fullMode) andalso not (passive e') then
e
else
- trySub ()
+ trySub true
end
val r =