From: Clemens Fruhwirth Date: Fri, 13 Jul 2007 21:03:55 +0000 (+0000) Subject: Fix the knot-tying in loopDecls to actually do what its comment tells: provide access... X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=1e15be89f436ae0a8ad0c2ca4fbf949c8f2c6cfc Fix the knot-tying in loopDecls to actually do what its comment tells: provide access to global declarations --- diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index 68bc26d..fa822f6 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -770,9 +770,12 @@ instance Monad ExtFCode where -- an environment, which is looped back into the computation. In this -- way, we can have embedded declarations that scope over the whole -- procedure, and imports that scope over the entire module. +-- Discards the local declaration contained within decl' loopDecls :: ExtFCode a -> ExtFCode a -loopDecls (EC fcode) = - EC $ \e s -> fixC (\ ~(decls,a) -> fcode (addListToUFM e decls) []) +loopDecls (EC fcode) = + EC $ \e globalDecls -> do + (decls', a) <- fixC (\ ~(decls,a) -> fcode (addListToUFM e (decls ++ globalDecls)) globalDecls) + return (globalDecls, a) getEnv :: ExtFCode Env getEnv = EC $ \e s -> return (s, e)