From: Matthijs Kooijman Date: Wed, 16 Jun 2010 13:37:19 +0000 (+0200) Subject: Add a CaseAlt constructor to CoreContext. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=commitdiff_plain;h=bebe01ce76e62bea88aba87d5cceecfab7a0c6c4 Add a CaseAlt constructor to CoreContext. Since a case expression can introduce a binder (for its scrutinee), we should be able to denote that in the CoreContext. --- diff --git a/clash/CLasH/Normalize/NormalizeTools.hs b/clash/CLasH/Normalize/NormalizeTools.hs index 3077956..0652081 100644 --- a/clash/CLasH/Normalize/NormalizeTools.hs +++ b/clash/CLasH/Normalize/NormalizeTools.hs @@ -113,7 +113,7 @@ subeverywhere trans c (Case scrut b t alts) = do where transalt :: CoreAlt -> TransformMonad CoreAlt transalt (con, binders, expr) = do - expr' <- trans (Other:c) expr + expr' <- trans ((CaseAlt b):c) expr return (con, binders, expr') subeverywhere trans c (Var x) = return $ Var x diff --git a/clash/CLasH/Normalize/NormalizeTypes.hs b/clash/CLasH/Normalize/NormalizeTypes.hs index 506633d..f4e5e9b 100644 --- a/clash/CLasH/Normalize/NormalizeTypes.hs +++ b/clash/CLasH/Normalize/NormalizeTypes.hs @@ -31,6 +31,9 @@ data CoreContext = AppFirst -- ^ The expression is the first | LambdaBody CoreSyn.CoreBndr -- ^ The expression is the body of a -- lambda abstraction + | CaseAlt CoreSyn.CoreBndr + -- ^ The expression is the body of a + -- case alternative. | Other -- ^ Another context deriving (Eq, Show) -- | Transforms a CoreExpr and keeps track if it has changed.