summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-05-17 16:06:52 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-03 14:11:31 -0400
commitf9f8099598fd169fa2f17305fc660e5c473f8836 (patch)
tree5acdb9a38b78dc17ffa0abb63d87555e214d98af /compiler/GHC/Parser
parent3a8970ac0c69335a1d229f9c9a71e6e333e99bfb (diff)
downloadhaskell-f9f8099598fd169fa2f17305fc660e5c473f8836.tar.gz
TTG: Move ImpExp client-independent bits to L.H.S.ImpExp
Move the GHC-independent definitions from GHC.Hs.ImpExp to Language.Haskell.Syntax.ImpExp with the required TTG extension fields such as to keep the AST independent from GHC. This is progress towards having the haskell-syntax package, as described in #21592 Bumps haddock submodule
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r--compiler/GHC/Parser/Header.hs10
-rw-r--r--compiler/GHC/Parser/PostProcess.hs7
2 files changed, 10 insertions, 7 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs
index 2a31d21cfc..9daf8e5d71 100644
--- a/compiler/GHC/Parser/Header.hs
+++ b/compiler/GHC/Parser/Header.hs
@@ -145,16 +145,18 @@ mkPrelImports this_mod loc implicit_prelude import_decls
loc' = noAnnSrcSpan loc
preludeImportDecl :: LImportDecl GhcPs
preludeImportDecl
- = L loc' $ ImportDecl { ideclExt = noAnn,
- ideclSourceSrc = NoSourceText,
+ = L loc' $ ImportDecl { ideclExt = XImportDeclPass
+ { ideclAnn = noAnn
+ , ideclSourceText = NoSourceText
+ , ideclImplicit = True -- Implicit!
+ },
ideclName = L loc' pRELUDE_NAME,
ideclPkgQual = NoRawPkgQual,
ideclSource = NotBoot,
ideclSafe = False, -- Not a safe import
ideclQualified = NotQualified,
- ideclImplicit = True, -- Implicit!
ideclAs = Nothing,
- ideclHiding = Nothing }
+ ideclImportList = Nothing }
--------------------------------------------------------------
-- Get options
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs
index e67e6d734e..9dabe3331d 100644
--- a/compiler/GHC/Parser/PostProcess.hs
+++ b/compiler/GHC/Parser/PostProcess.hs
@@ -2787,7 +2787,7 @@ mkModuleImpExp anns (L l specname) subs = do
let withs = map unLoc xs
pos = maybe NoIEWildcard IEWildcard
(findIndex isImpExpQcWildcard withs)
- ies :: [LocatedA (IEWrappedName RdrName)]
+ ies :: [LocatedA (IEWrappedName GhcPs)]
ies = wrapped $ filter (not . isImpExpQcWildcard . unLoc) xs
in (\newName
-> IEThingWith ann (L l newName) pos ies)
@@ -2806,8 +2806,9 @@ mkModuleImpExp anns (L l specname) subs = do
ieNameVal (ImpExpQcType _ ln) = unLoc ln
ieNameVal (ImpExpQcWildcard) = panic "ieNameVal got wildcard"
- ieNameFromSpec (ImpExpQcName ln) = IEName ln
- ieNameFromSpec (ImpExpQcType r ln) = IEType r ln
+ ieNameFromSpec :: ImpExpQcSpec -> IEWrappedName GhcPs
+ ieNameFromSpec (ImpExpQcName (L l n)) = IEName noExtField (L l n)
+ ieNameFromSpec (ImpExpQcType r (L l n)) = IEType r (L l n)
ieNameFromSpec (ImpExpQcWildcard) = panic "ieName got wildcard"
wrapped = map (mapLoc ieNameFromSpec)