@@ -1424,17 +1424,30 @@ elimConds js =
14241424 isCond :: JS -> Bool
14251425 isCond (JSAlloc
14261426 fun (Just (JSFunction args (JSCond
1427− [ (JSBinOp "==" (JSNum (JSInt tag)) _, JSReturn (JSIdent _))
1428− , (JSNoop, JSReturn (JSIdent _))
1429− ]))
1430− )) = True
1427+ [ (JSBinOp "==" (JSNum (JSInt tag)) (JSProj (JSIdent _) "tag"), JSReturn t)
1428+ , (JSNoop, JSReturn f)
1429+ ])))
1430+ )
1431+ | isJSConstant t && isJSConstant f =
1432+ True
1433+
1434+ | JSIdent _ <- t
1435+ , JSIdent _ <- f =
1436+ True
14311437
14321438 isCond (JSAlloc
14331439 fun (Just (JSFunction args (JSCond
1434− [ (JSBinOp "==" _ (JSNum (JSInt tag)), JSReturn (JSIdent _))
1435− , (JSNoop, JSReturn (JSIdent _))
1436− ]))
1437− )) = True
1440+ [ (JSBinOp "==" (JSIdent _) c, JSReturn t)
1441+ , (JSNoop, JSReturn f)
1442+ ])))
1443+ )
1444+ | isJSConstant t && isJSConstant f && isJSConstant c =
1445+ True
1446+
1447+ | JSIdent _ <- t
1448+ , JSIdent _ <- f
1449+ , isJSConstant c =
1450+ True
14381451
14391452 isCond _ = False
14401453