on master help sign in
javascript: optimize operator calls
commitd5c8aec8a386eb3022215b9e15f1434af5c8b235 authorraichoo <raichoo@googlemail.com> dateMon 7 Oct 2013, 21:16 (13 years ago) parentcaa3193
1 file changed+4
src/IRTS/CodegenJavaScript.hs+4
src/IRTS/CodegenJavaScript.hs+4
@@ -240,6 +240,10 @@ optimizeJS (JSApp (JSFunction [arg] (JSReturn ret)) [val])
240240 JSReturn $ JSApp fun (jsSubst arg args (optimizeJS val))
241241 )]
242242
243+ | JSOp op lhs rhs <- ret =
244+ JSOp op (head $ jsSubst arg [lhs] (optimizeJS val)) $
245+ (head $ jsSubst arg [rhs] (optimizeJS val))
246+
243247optimizeJS (JSSeq seq) =
244248 JSSeq (map optimizeJS seq)
245249