diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-10-08 15:03:01 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-10-09 10:29:12 -0700 |
commit | e5baf62dfac7fd81acc2bd570ba7d3b1fedd8363 (patch) | |
tree | 3cf68147df2b53c604b03dd94f1c48d416dc1d20 /compiler/main/HeaderInfo.hs | |
parent | c7ab79952e3fd0654108909fc372e4df5ffff91e (diff) | |
download | haskell-e5baf62dfac7fd81acc2bd570ba7d3b1fedd8363.tar.gz |
Simplify type of ms_srcimps and ms_textual_imps.
Summary:
Previously, we stored an entire ImportDecl, which was pretty
wasteful since all we really cared about was the package qualifier
and the module name.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1317
Diffstat (limited to 'compiler/main/HeaderInfo.hs')
-rw-r--r-- | compiler/main/HeaderInfo.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index 3473a4ab88..b4c3f81678 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -37,6 +37,7 @@ import Maybes import Bag ( emptyBag, listToBag, unitBag ) import MonadUtils import Exception +import BasicTypes import Control.Monad import System.IO @@ -54,7 +55,9 @@ getImports :: DynFlags -- reporting parse error locations. -> FilePath -- ^ The original source filename (used for locations -- in the function result) - -> IO ([Located (ImportDecl RdrName)], [Located (ImportDecl RdrName)], Located ModuleName) + -> IO ([(Maybe FastString, Located ModuleName)], + [(Maybe FastString, Located ModuleName)], + Located ModuleName) -- ^ The source imports, normal imports, and the module name. getImports dflags buf filename source_filename = do let loc = mkRealSrcLoc (mkFastString filename) 1 1 @@ -83,8 +86,11 @@ getImports dflags buf filename source_filename = do implicit_prelude = xopt Opt_ImplicitPrelude dflags implicit_imports = mkPrelImports (unLoc mod) main_loc implicit_prelude imps + convImport (L _ i) = (fmap sl_fs (ideclPkgQual i), ideclName i) in - return (src_idecls, implicit_imports ++ ordinary_imps, mod) + return (map convImport src_idecls, + map convImport (implicit_imports ++ ordinary_imps), + mod) mkPrelImports :: ModuleName -> SrcSpan -- Attribute the "import Prelude" to this location |