# HG changeset patch # User Adam Chlipala # Date 1370182672 14400 # Node ID bddd0ec5d3dac2b3923c5830f1026a528383b0b7 # Parent f405dfe1f1e119762ca7f98a048bf3e64524a6d5 Tweak to 'let' inlining behavior diff -r f405dfe1f1e1 -r bddd0ec5d3da src/mono_reduce.sml --- a/src/mono_reduce.sml Sun Apr 21 13:32:10 2013 -0400 +++ b/src/mono_reduce.sml Sun Jun 02 10:17:52 2013 -0400 @@ -564,16 +564,19 @@ #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 @@ | _ => 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 =