X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmParse.y;h=fa822f60a4f6552f65fd75e1461d862938a4f601;hp=68bc26dd4ed63089eecc44fa1798450f3b864813;hb=1e15be89f436ae0a8ad0c2ca4fbf949c8f2c6cfc;hpb=1e793a163e9ef38ec3dd8cbb02c4ad793c842a53 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)