@@ -1062,7 +1062,7 @@ extractLocalConstructors js =
10621062
10631063evalCons :: [JS] -> [JS]
10641064evalCons js =
1065− map (expandProj . evalCons') js
1065+ map (collapseTC . expandProj . evalCons') js
10661066 where
10671067 cons :: [(String, JS)]
10681068 cons = concatMap getGlobalCons js
@@ -1095,6 +1095,18 @@ evalCons js =
10951095 match js = transformJS match js
10961096
10971097
1098+ collapseTC :: JS -> JS
1099+ collapseTC js = transformJS match js
1100+ where
1101+ match :: JS -> JS
1102+ match (JSApp (JSIdent "__IDRRT__tailcall") [JSFunction [] (
1103+ JSReturn (JSIdent name)
1104+ )])
1105+ | Just _ <- lookup name cons = (JSIdent name)
1106+
1107+ match js = transformJS match js
1108+
1109+
10981110getGlobalCons :: JS -> [(String, JS)]
10991111getGlobalCons js = foldJS match (++) [] js
11001112 where