on master help sign in
javascript: reduce tailcalls for reduced functions
0efe215raichoo
src/IRTS/CodegenJavaScript.hs+5
@@ -353,6 +353,11 @@ reduceJS program =
353 funNames _ = error "WTF?"
353 funNames _ = error "WTF?"
354
354
355 reduceCall :: [String] -> JS -> JS
355 reduceCall :: [String] -> JS -> JS
356+ reduceCall funs (JSApp (JSRaw "__IDRRT__tailcall") [JSFunction [] (
357+ JSReturn (JSApp (JSRaw ret) [])
358+ )])
359+ | ret `elem` funs = JSRaw ret
360+
356 reduceCall funs js@(JSApp (JSRaw fun) [])
361 reduceCall funs js@(JSApp (JSRaw fun) [])
357 | fun `elem` funs = JSRaw fun
362 | fun `elem` funs = JSRaw fun
358 | otherwise = js
363 | otherwise = js