From 1e15be89f436ae0a8ad0c2ca4fbf949c8f2c6cfc Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Fri, 13 Jul 2007 21:03:55 +0000 Subject: [PATCH] Fix the knot-tying in loopDecls to actually do what its comment tells: provide access to global declarations --- compiler/cmm/CmmParse.y | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) -- 1.7.10.4