diff options
author | David Waern <david.waern@gmail.com> | 2012-04-01 01:51:34 +0200 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2012-04-01 01:51:34 +0200 |
commit | 82975d2984851e9385fbb3bf1fe9c1786369aba6 (patch) | |
tree | 33aea949fa97679ccc864ccd1ed83a1d468408a1 /src/Haddock | |
parent | dec878df8eebb8e831d42db865d59b4e082ec4de (diff) |
Take reader environment directly from TypecheckedSource.
Diffstat (limited to 'src/Haddock')
-rw-r--r-- | src/Haddock/Interface/Create.hs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index ed51734d..d0b8b14f 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -35,7 +35,7 @@ import HscTypes import Name import Bag import RdrName -import TcRnTypes (tcg_warns) +import TcRnTypes import FastString (unpackFS) @@ -51,7 +51,7 @@ createInterface tm flags modMap instIfaceMap = do dflags = ms_hspp_opts ms instances = modInfoInstances mi exportedNames = modInfoExports mi - warnings = tcg_warns . fst . tm_internals_ $ tm + (TcGblEnv {tcg_rdr_env = gre, tcg_warns = warnings}, _) = tm_internals_ tm -- The renamed source should always be available to us, but it's best -- to be on the safe side. @@ -62,9 +62,17 @@ createInterface tm flags modMap instIfaceMap = do return (emptyRnGroup, Nothing, Nothing) Just (x, _, y, z) -> return (x, y, z) +{- -- The pattern-match should not fail, because createInterface is only -- done on loaded modules. - Just gre <- liftGhcToErrMsgGhc $ lookupLoadedHomeModuleGRE (moduleName mdl) + gre0 <- liftGhcToErrMsgGhc $ lookupLoadedHomeModuleGRE (moduleName mdl) + gre <- + case gre0 of + Nothing -> do + liftErrMsg $ tell [ "Warning: Could not find module in renaming environment: " ++ pretty mdl ] + return emptyGlobalRdrEnv + Just gre -> return gre +-} opts0 <- liftErrMsg $ mkDocOpts (haddockOptions dflags) flags mdl let opts |