diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-07 18:03:36 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-13 02:13:02 -0400 |
commit | 72d086106d49bc18277f3a066e671e87e9b37a1b (patch) | |
tree | ff20c2926d4234c2cecc5d230859fc9fce09bb85 /compiler/GHC/Parser/Lexer.x | |
parent | 7a02599afe836ac32c2e732671415d0afdfbf7fb (diff) | |
download | haskell-72d086106d49bc18277f3a066e671e87e9b37a1b.tar.gz |
Refactor homeUnit
* rename thisPackage into homeUnit
* document and refactor several Backpack things
Diffstat (limited to 'compiler/GHC/Parser/Lexer.x')
-rw-r--r-- | compiler/GHC/Parser/Lexer.x | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 1411ba32ff..542af41557 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -55,7 +55,7 @@ module GHC.Parser.Lexer ( appendError, allocateComments, MonadP(..), - getRealSrcLoc, getPState, withThisPackage, + getRealSrcLoc, getPState, withHomeUnit, failMsgP, failLocMsgP, srcParseFail, getErrorMessages, getMessages, popContext, pushModuleContext, setLastToken, setSrcLoc, @@ -2088,7 +2088,7 @@ warnopt f options = f `EnumSet.member` pWarningFlags options -- See 'mkParserFlags' or 'mkParserFlags'' for ways to construct this. data ParserFlags = ParserFlags { pWarningFlags :: EnumSet WarningFlag - , pThisPackage :: Unit -- ^ key of package currently being compiled + , pHomeUnit :: Unit -- ^ unit currently being compiled , pExtsBitmap :: !ExtsBitmap -- ^ bitmap of permitted extensions } @@ -2183,8 +2183,8 @@ failLocMsgP loc1 loc2 str = getPState :: P PState getPState = P $ \s -> POk s s -withThisPackage :: (Unit -> a) -> P a -withThisPackage f = P $ \s@(PState{options = o}) -> POk s (f (pThisPackage o)) +withHomeUnit :: (Unit -> a) -> P a +withHomeUnit f = P $ \s@(PState{options = o}) -> POk s (f (pHomeUnit o)) getExts :: P ExtsBitmap getExts = P $ \s -> POk s (pExtsBitmap . options $ s) @@ -2512,12 +2512,12 @@ mkParserFlags' -> ParserFlags -- ^ Given exactly the information needed, set up the 'ParserFlags' -mkParserFlags' warningFlags extensionFlags thisPackage +mkParserFlags' warningFlags extensionFlags homeUnit safeImports isHaddock rawTokStream usePosPrags = ParserFlags { pWarningFlags = warningFlags - , pThisPackage = thisPackage - , pExtsBitmap = safeHaskellBit .|. langExtBits .|. optBits + , pHomeUnit = homeUnit + , pExtsBitmap = safeHaskellBit .|. langExtBits .|. optBits } where safeHaskellBit = SafeHaskellBit `setBitIf` safeImports @@ -2578,7 +2578,7 @@ mkParserFlags = mkParserFlags' <$> DynFlags.warningFlags <*> DynFlags.extensionFlags - <*> DynFlags.thisPackage + <*> DynFlags.homeUnit <*> safeImportsOn <*> gopt Opt_Haddock <*> gopt Opt_KeepRawTokenStream |