Fix the knot-tying in loopDecls to actually do what its comment tells: provide access...
authorClemens Fruhwirth <clemens@endorphin.org>
Fri, 13 Jul 2007 21:03:55 +0000 (21:03 +0000)
committerClemens Fruhwirth <clemens@endorphin.org>
Fri, 13 Jul 2007 21:03:55 +0000 (21:03 +0000)
compiler/cmm/CmmParse.y

index 68bc26d..fa822f6 100644 (file)
@@ -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)