From: sof Date: Fri, 25 Jul 1997 22:48:28 +0000 (+0000) Subject: [project @ 1997-07-25 22:48:28 by sof] X-Git-Tag: Approximately_1000_patches_recorded~228 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b9b0688a995d9b37c078507449901b20bf732daa;p=ghc-hetmet.git [project @ 1997-07-25 22:48:28 by sof] rnExprs made stricter --- diff --git a/ghc/compiler/rename/RnExpr.lhs b/ghc/compiler/rename/RnExpr.lhs index ac323ac..ad7d404 100644 --- a/ghc/compiler/rename/RnExpr.lhs +++ b/ghc/compiler/rename/RnExpr.lhs @@ -44,7 +44,7 @@ import Id ( GenId ) import ErrUtils ( addErrLoc, addShortErrLocLine ) import Name import Pretty -import UniqFM ( lookupUFM{-, ufmToList ToDo:rm-} ) +import UniqFM ( lookupUFM, {- ToDo:rm-} isNullUFM ) import UniqSet ( emptyUniqSet, unitUniqSet, unionUniqSets, unionManyUniqSets, SYN_IE(UniqSet) @@ -225,15 +225,23 @@ rnGRHSsAndBinds (GRHSsAndBindsIn grhss binds) \begin{code} rnExprs :: [RdrNameHsExpr] -> RnMS s ([RenamedHsExpr], FreeVars) -rnExprs ls = - rnExprs' ls [] `thenRn` \ (exprs, fvExprs) -> - returnRn (exprs, unionManyNameSets fvExprs) - -rnExprs' [] acc = returnRn ([], acc) -rnExprs' (expr:exprs) acc - = rnExpr expr `thenRn` \ (expr', fvExpr) -> - rnExprs' exprs (fvExpr:acc) `thenRn` \ (exprs', fvExprs) -> +rnExprs ls = rnExprs' ls emptyUniqSet + where + rnExprs' [] acc = returnRn ([], acc) + rnExprs' (expr:exprs) acc + = rnExpr expr `thenRn` \ (expr', fvExpr) -> + + -- Now we do a "seq" on the free vars because typically it's small + -- or empty, especially in very long lists of constants + let + acc' = acc `unionNameSets` fvExpr + in + (grubby_seqNameSet acc' rnExprs') exprs acc' `thenRn` \ (exprs', fvExprs) -> returnRn (expr':exprs', fvExprs) + +-- Grubby little function to do "seq" on namesets; replace by proper seq when GHC can do seq +grubby_seqNameSet ns result | isNullUFM ns = result + | otherwise = result \end{code} Variables. We look up the variable and return the resulting name. The