X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Flatten.hs;h=8c4c7ab51ba2e3f536f97e5b3001dde863ebb396;hb=a879bbd83d5ce95e0d05aa117819edf88bc8f6d4;hp=74b3232a338640a1372d120ce164b6b388be6b12;hpb=6808406c77307ba110ec5fc7e03fa7359fdf4646;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Flatten.hs b/Flatten.hs index 74b3232..8c4c7ab 100644 --- a/Flatten.hs +++ b/Flatten.hs @@ -268,11 +268,12 @@ flattenExpr binds expr@(Case scrut b _ alts) = do -- TODO: Special casing for higher order functions -- Flatten the scrutinee (_, res) <- flattenExpr binds scrut + -- Put the scrutinee in the BindMap + let binds' = (b, Left res) : binds case alts of - -- TODO include b in the binds list - [alt] -> flattenSingleAltCaseExpr binds res b alt + [alt] -> flattenSingleAltCaseExpr binds' res b alt -- Reverse the alternatives, so the __DEFAULT alternative ends up last - otherwise -> flattenMultipleAltCaseExpr binds res b (reverse alts) + otherwise -> flattenMultipleAltCaseExpr binds' res b (reverse alts) where flattenSingleAltCaseExpr :: BindMap