@@ -1237,24 +1237,24 @@ codegenJavaScript target definitions filename outputType = do
12371237 compile =
12381238 map compileJS
12391239
1240− opt =
1241− [ map optimizeJS
1242− , removeIDs
1243− , reduceJS
1244− , map reduceConstants
1245− , initConstructors
1246− , map removeAllocations
1247− , elimDeadLoop
1248− , map elimDuplicateEvals
1249− , optimizeRuntimeCalls "__IDR__mEVAL0" "__IDRRT__EVALTC"
1250− , optimizeRuntimeCalls "__IDR__mAPPLY0" "__IDRRT__APPLYTC"
1251− , map removeInstanceChecks
1252− , inlineFunctions
1253− , map reduceContinuations
1254− , extractLocalConstructors
1255− , unfoldLookupTable
1256− , evalCons
1257− ]
1240+ opt = []
1241+ {-[ map optimizeJS-}
1242+ {-, removeIDs-}
1243+ {-, reduceJS-}
1244+ {-, map reduceConstants-}
1245+ {-, initConstructors-}
1246+ {-, map removeAllocations-}
1247+ {-, elimDeadLoop-}
1248+ {-, map elimDuplicateEvals-}
1249+ {-, optimizeRuntimeCalls "__IDR__mEVAL0" "__IDRRT__EVALTC"-}
1250+ {-, optimizeRuntimeCalls "__IDR__mAPPLY0" "__IDRRT__APPLYTC"-}
1251+ {-, map removeInstanceChecks-}
1252+ {-, inlineFunctions-}
1253+ {-, map reduceContinuations-}
1254+ {-, extractLocalConstructors-}
1255+ {-, unfoldLookupTable-}
1256+ {-, evalCons-}
1257+ {-]-}
12581258
12591259 prelude :: [JS]
12601260 prelude =
@@ -1413,42 +1413,42 @@ translateConstant c =
14131413
14141414translateDeclaration :: (String, SDecl) -> [JS]
14151415translateDeclaration (path, SFun name params stackSize body)
1416− | (MN _ ap) <- name
1417− , (SLet var val next) <- body
1418− , (SChkCase cvar cases) <- next
1419− , ap == txt "APPLY" =
1420− let lvar = translateVariableName var
1421− lookup t = (JSApp
1422− (JSIndex (JSIdent t) (JSProj (JSIdent lvar) "tag"))
1423− [JSIdent "fn0", JSIdent "arg0", JSIdent lvar]) in
1424− [ lookupTable "APPLY" [(var, "chk")] var cases
1425− , jsDecl $ JSFunction ["fn0", "arg0"] (
1426− JSSeq [ JSAlloc "__var_0" (Just $ JSIdent "fn0")
1427− , JSAlloc (translateVariableName var) (
1428− Just $ translateExpression val
1429− )
1430− , JSReturn $ (JSTernary (
1431− (JSVar var `jsInstanceOf` jsCon) `jsAnd`
1432− (hasProp (idrLTNamespace ++ "APPLY") (translateVariableName var))
1433− ) (lookup (idrLTNamespace ++ "APPLY")) JSNull)
1434− ]
1435− )
1436− ]
1437−
1438− | (MN _ ev) <- name
1439− , (SChkCase var cases) <- body
1440− , ev == txt "EVAL" =
1441− [ lookupTable "EVAL" [] var cases
1442− , jsDecl $ JSFunction ["arg0"] (JSReturn $
1443− JSTernary (
1444− (JSIdent "arg0" `jsInstanceOf` jsCon) `jsAnd`
1445− (hasProp (idrLTNamespace ++ "EVAL") "arg0")
1446− ) (JSApp
1447− (JSIndex (JSIdent (idrLTNamespace ++ "EVAL")) (JSProj (JSIdent "arg0") "tag"))
1448− [JSIdent "arg0"]
1449− ) (JSIdent "arg0")
1450− )
1451− ]
1416+ {-| (MN _ ap) <- name-}
1417+ {-, (SLet var val next) <- body-}
1418+ {-, (SChkCase cvar cases) <- next-}
1419+ {-, ap == txt "APPLY" =-}
1420+ {-let lvar = translateVariableName var-}
1421+ {-lookup t = (JSApp-}
1422+ {-(JSIndex (JSIdent t) (JSProj (JSIdent lvar) "tag"))-}
1423+ {-[JSIdent "fn0", JSIdent "arg0", JSIdent lvar]) in-}
1424+ {-[ lookupTable "APPLY" [(var, "chk")] var cases-}
1425+ {-, jsDecl $ JSFunction ["fn0", "arg0"] (-}
1426+ {-JSSeq [ JSAlloc "__var_0" (Just $ JSIdent "fn0")-}
1427+ {-, JSAlloc (translateVariableName var) (-}
1428+ {-Just $ translateExpression val-}
1429+ {-)-}
1430+ {-, JSReturn $ (JSTernary (-}
1431+ {-(JSVar var `jsInstanceOf` jsCon) `jsAnd`-}
1432+ {-(hasProp (idrLTNamespace ++ "APPLY") (translateVariableName var))-}
1433+ {-) (lookup (idrLTNamespace ++ "APPLY")) JSNull)-}
1434+ {-]-}
1435+ {-)-}
1436+ {-]-}
1437+
1438+ {-| (MN _ ev) <- name-}
1439+ {-, (SChkCase var cases) <- body-}
1440+ {-, ev == txt "EVAL" =-}
1441+ {-[ lookupTable "EVAL" [] var cases-}
1442+ {-, jsDecl $ JSFunction ["arg0"] (JSReturn $-}
1443+ {-JSTernary (-}
1444+ {-(JSIdent "arg0" `jsInstanceOf` jsCon) `jsAnd`-}
1445+ {-(hasProp (idrLTNamespace ++ "EVAL") "arg0")-}
1446+ {-) (JSApp-}
1447+ {-(JSIndex (JSIdent (idrLTNamespace ++ "EVAL")) (JSProj (JSIdent "arg0") "tag"))-}
1448+ {-[JSIdent "arg0"]-}
1449+ {-) (JSIdent "arg0")-}
1450+ {-)-}
1451+ {-]-}
14521452 | otherwise =
14531453 let fun = translateExpression body in
14541454 [jsDecl $ jsFun fun]