diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-10-23 10:49:55 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-24 01:27:21 -0400 |
commit | 691c450f1e9cc3fd83b662be3c0134fde03e97db (patch) | |
tree | dff88e789b1af701542301d7303559b3585856e2 /compiler/GHC/Parser | |
parent | 3bab222c585343f8febe2a627d280b7be9401e92 (diff) | |
download | haskell-691c450f1e9cc3fd83b662be3c0134fde03e97db.tar.gz |
EPA: Use LocatedA for ModuleName
This allows us to use an Anchor with a DeltaPos in it when exact
printing.
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/Header.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index c19c873c91..cb8a5c334e 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -97,7 +97,7 @@ getImports popts implicit_prelude buf filename source_filename = do imps = hsmodImports hsmod main_loc = srcLocSpan (mkSrcLoc (mkFastString source_filename) 1 1) - mod = mb_mod `orElse` L main_loc mAIN_NAME + mod = mb_mod `orElse` L (noAnnSrcSpan main_loc) mAIN_NAME (src_idecls, ord_idecls) = partition ((== IsBoot) . ideclSource . unLoc) imps -- GHC.Prim doesn't exist physically, so don't go looking for it. @@ -108,12 +108,12 @@ getImports popts implicit_prelude buf filename source_filename = do implicit_imports = mkPrelImports (unLoc mod) main_loc implicit_prelude imps - convImport (L _ i) = (ideclPkgQual i, ideclName i) + convImport (L _ i) = (ideclPkgQual i, reLoc $ ideclName i) in return (map convImport src_idecls , map convImport (implicit_imports ++ ordinary_imps) , not (null ghc_prim_import) - , mod) + , reLoc mod) mkPrelImports :: ModuleName -> SrcSpan -- Attribute the "import Prelude" to this location @@ -146,7 +146,7 @@ mkPrelImports this_mod loc implicit_prelude import_decls preludeImportDecl = L loc' $ ImportDecl { ideclExt = noAnn, ideclSourceSrc = NoSourceText, - ideclName = L loc pRELUDE_NAME, + ideclName = L loc' pRELUDE_NAME, ideclPkgQual = NoRawPkgQual, ideclSource = NotBoot, ideclSafe = False, -- Not a safe import diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 5cb81edcdb..f0adba4e6f 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -249,10 +249,10 @@ instance HasHaddock (Located HsModule) where -- Only do this when the module header exists. headerDocs <- for @Maybe (hsmodName mod) $ \(L l_name _) -> - extendHdkA l_name $ liftHdkA $ do + extendHdkA (locA l_name) $ liftHdkA $ do -- todo: register keyword location of 'module', see Note [Register keyword location] docs <- - inLocRange (locRangeTo (getBufPos (srcSpanStart l_name))) $ + inLocRange (locRangeTo (getBufPos (srcSpanStart (locA l_name)))) $ takeHdkComments mkDocNext selectDocString docs |