summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-03-15 14:30:33 -0400
committerBen Gamari <ben@smart-cactus.org>2017-03-15 15:23:22 -0400
commitcc9d574a578090d17d1597628e44371003cb19a7 (patch)
treee93ecdb8e419e17c28003d9e15e78fe055691b45 /compiler/parser
parenta7be163196f452530b61cbb526631db946d20e8b (diff)
downloadhaskell-cc9d574a578090d17d1597628e44371003cb19a7.tar.gz
Introduce and use EnumSet in DynFlags
This factors out a repeated pattern found in DynFlags, where we use an IntSet and Enum to represent sets of flags. Requires bump of haddock submodule. Test Plan: validate Reviewers: austin, goldfire Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3331
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Lexer.x12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 3d6fa1609c..a6e0a7b54d 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -86,8 +86,8 @@ import Data.List
import Data.Maybe
import Data.Word
-import Data.IntSet (IntSet)
-import qualified Data.IntSet as IntSet
+import EnumSet (EnumSet)
+import qualified EnumSet
-- ghc-boot
import qualified GHC.LanguageExtensions as LangExt
@@ -1798,16 +1798,16 @@ data ParseResult a
-- | Test whether a 'WarningFlag' is set
warnopt :: WarningFlag -> ParserFlags -> Bool
-warnopt f options = fromEnum f `IntSet.member` pWarningFlags options
+warnopt f options = f `EnumSet.member` pWarningFlags options
-- | Test whether a 'LangExt.Extension' is set
extopt :: LangExt.Extension -> ParserFlags -> Bool
-extopt f options = fromEnum f `IntSet.member` pExtensionFlags options
+extopt f options = f `EnumSet.member` pExtensionFlags options
-- | The subset of the 'DynFlags' used by the parser
data ParserFlags = ParserFlags {
- pWarningFlags :: IntSet
- , pExtensionFlags :: IntSet
+ pWarningFlags :: EnumSet WarningFlag
+ , pExtensionFlags :: EnumSet LangExt.Extension
, pThisPackage :: UnitId -- ^ key of package currently being compiled
, pExtsBitmap :: !ExtsBitmap -- ^ bitmap of permitted extensions
}