diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-09-22 18:28:35 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-22 19:20:44 -0400 |
commit | 806e49ae36a058dbe4494055a6b936dd153c6194 (patch) | |
tree | 982c304986bf925187aae36997d4602e3419c8e9 /compiler/GHC/Parser.y | |
parent | 6fd7da745a518a93f6685171701a27283cfe2d4e (diff) | |
download | haskell-806e49ae36a058dbe4494055a6b936dd153c6194.tar.gz |
Refactor package imports
Use an (Raw)PkgQual datatype instead of `Maybe FastString` to represent
package imports. Factorize the code that renames RawPkgQual into PkgQual
in function `rnPkgQual`. Renaming consists in checking if the FastString
is the magic "this" keyword, the home-unit unit-id or something else.
Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r-- | compiler/GHC/Parser.y | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index b0b6a89e52..d3781af3b5 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -77,6 +77,7 @@ import GHC.Types.Fixity import GHC.Types.ForeignCall import GHC.Types.SourceFile import GHC.Types.SourceText +import GHC.Types.PkgQual import GHC.Core.Type ( unrestrictedFunTyCon, Specificity(..) ) import GHC.Core.Class ( FunDep ) @@ -1126,13 +1127,13 @@ maybe_safe :: { (Maybe EpaLocation,Bool) } : 'safe' { (Just (glAA $1),True) } | {- empty -} { (Nothing, False) } -maybe_pkg :: { (Maybe EpaLocation,Maybe StringLiteral) } +maybe_pkg :: { (Maybe EpaLocation, RawPkgQual) } : STRING {% do { let { pkgFS = getSTRING $1 } ; unless (looksLikePackageName (unpackFS pkgFS)) $ addError $ mkPlainErrorMsgEnvelope (getLoc $1) $ (PsErrInvalidPackageName pkgFS) - ; return (Just (glAA $1), Just (StringLiteral (getSTRINGs $1) pkgFS Nothing)) } } - | {- empty -} { (Nothing,Nothing) } + ; return (Just (glAA $1), RawPkgQual (StringLiteral (getSTRINGs $1) pkgFS Nothing)) } } + | {- empty -} { (Nothing,NoRawPkgQual) } optqualified :: { Located (Maybe EpaLocation) } : 'qualified' { sL1 $1 (Just (glAA $1)) } |