@@ -1449,6 +1449,21 @@ elimConds js =
1449 )) = map (inlineFunction fun args (JSTernary c t f)) js
1449 )) = map (inlineFunction fun args (JSTernary c t f)) js
1452+removeUselessCons :: [JS] -> [JS]
1453+removeUselessCons js =
1454+ let (cons, rest) = partition isUseless js in
1455+ foldl' eraseCon rest cons
1457+ isUseless :: JS -> Bool
1458+ isUseless (JSAlloc fun (Just JSNull)) = True
1459+ isUseless (JSAlloc fun (Just (JSIdent _))) = True
1460+ isUseless _ = False
1463+ eraseCon :: [JS] -> JS -> [JS]
1464+ eraseCon js (JSAlloc fun (Just val)) = map (jsSubst (JSIdent fun) val) js
1452getGlobalCons :: JS -> [(String, JS)]
1467getGlobalCons :: JS -> [(String, JS)]
1453getGlobalCons js = foldJS match (++) [] js
1468getGlobalCons js = foldJS match (++) [] js
@@ -1551,6 +1566,7 @@ codegenJS_all target definitions includes filename outputType = do
1551 , unfoldLookupTable
1566 , unfoldLookupTable
1552 , evalCons
1567 , evalCons
1553 , elimConds
1568 , elimConds
1569+ , removeUselessCons
1556 functions :: [String]
1572 functions :: [String]