comparison src/mono_opt.sml @ 184:98c29e3986d3

Push write inside case
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 16:53:13 -0400
parents c0ea24dcb86f
children 19ee24bffbc0
comparison
equal deleted inserted replaced
183:c0ea24dcb86f 184:98c29e3986d3
183 | EWrite (EFfiApp ("Basis", "urlifyString", [(EPrim (Prim.String s), _)]), loc) => 183 | EWrite (EFfiApp ("Basis", "urlifyString", [(EPrim (Prim.String s), _)]), loc) =>
184 EWrite (EPrim (Prim.String (urlifyString s)), loc) 184 EWrite (EPrim (Prim.String (urlifyString s)), loc)
185 | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) => 185 | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) =>
186 EFfiApp ("Basis", "urlifyString_w", [e]) 186 EFfiApp ("Basis", "urlifyString_w", [e])
187 187
188
189 | EWrite (ECase (discE, pes, {disc, ...}), loc) =>
190 optExp (ECase (discE,
191 map (fn (p, e) => (p, (EWrite e, loc))) pes,
192 {disc = disc,
193 result = (TRecord [], loc)}), loc)
194
188 | _ => e 195 | _ => e
189 196
190 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e) 197 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e)
191 198
192 val optimize = U.File.map {typ = typ, exp = exp, decl = decl} 199 val optimize = U.File.map {typ = typ, exp = exp, decl = decl}