@@ -1060,6 +1060,52 @@ extractLocalConstructors js =
1063+evalCons :: [JS] -> [JS]
1065+ map (expandProj . evalCons') js
1067+ cons :: [(String, JS)]
1068+ cons = concatMap getGlobalCons js
1070+ evalCons' :: JS -> JS
1071+ evalCons' js = transformJS match js
1074+ match (JSApp (JSIdent "__IDRRT__EVALTC") [arg])
1075+ | JSIdent name <- arg
1076+ , Just (JSNew _ [_, JSNull, _, _]) <- lookup name cons = arg
1078+ match js = transformJS match js
1081+ expandProj :: JS -> JS
1082+ expandProj js = transformJS match js
1087+ JSProj (JSIdent name) "vars"
1092+ | Just (JSNew _ [_, _, _, JSArray args]) <- lookup name cons =
1095+ match js = transformJS match js
1098+getGlobalCons :: JS -> [(String, JS)]
1099+getGlobalCons js = foldJS match (++) [] js
1101+ match :: JS -> [(String, JS)]
1103+ | (JSAlloc name (Just con@(JSNew "__IDRRT__Con" _))) <- js =
1063codegenJavaScript
1109codegenJavaScript
1064 :: JSTarget
1110 :: JSTarget
1065 -> [(Name, SDecl)]
1111 -> [(Name, SDecl)]
@@ -1118,6 +1164,7 @@ codegenJavaScript target definitions filename outputType = do
1118 , map reduceContinuations
1164 , map reduceContinuations
1119 , extractLocalConstructors
1165 , extractLocalConstructors
1120 , unfoldLookupTable
1166 , unfoldLookupTable
1123 prelude :: [JS]
1170 prelude :: [JS]