@@ -858,7 +858,7 @@ unfoldLookupTable input =
859 adaptRuntime :: [JS] -> [JS]
859 adaptRuntime :: [JS] -> [JS]
860 adaptRuntime js =
860 adaptRuntime js =
861− (adaptEval . adaptApply . adaptCon) js
861+ (adaptApplyTC . adaptEval . adaptApply . adaptCon) js
864 adaptApply :: [JS] -> [JS]
864 adaptApply :: [JS] -> [JS]
@@ -886,6 +886,39 @@ unfoldLookupTable input =
889+ adaptApplyTC :: [JS] -> [JS]
890+ adaptApplyTC js = adaptApplyTC' [] js
892+ adaptApplyTC' :: [JS] -> [JS] -> [JS]
893+ adaptApplyTC' front ((JSAlloc "__IDRRT__APPLYTC" (Just _)):back) =
896+ adaptApplyTC' front (next:back) =
897+ adaptApplyTC' (front ++ [next]) back
899+ adaptApplyTC' front [] = front
902+ JSAlloc "__IDRRT__APPLYTC" (Just $ JSFunction ["mfn0", "marg0"] (
903+ JSSeq [ JSAlloc "ret" $ Just (
905+ (JSIdent "mfn0" `jsInstanceOf` jsCon) `jsAnd`
906+ (JSProj (JSIdent "mfn0") "app")
908+ (JSProj (JSIdent "mfn0") "app")
909+ [JSIdent "mfn0", JSIdent "marg0"]
912+ , JSWhile (JSIdent "ret" `jsInstanceOf` (JSIdent "__IDRRT__Cont")) (
913+ JSAssign (JSIdent "ret") (
914+ JSApp (JSProj (JSIdent "ret") "k") []
917+ , JSReturn $ JSIdent "ret"
889 adaptEval :: [JS] -> [JS]
922 adaptEval :: [JS] -> [JS]
890 adaptEval js = adaptEval' [] js
923 adaptEval js = adaptEval' [] js