diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-11-30 11:11:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 11:11:37 -0500 |
commit | 284c9a0c304faf9c186421a62da5d8b4dc73a8a2 (patch) | |
tree | a22b6bc6059797a5a1c28f758b04bbe76436bc0a /haddock-api/src/Haddock/Options.hs | |
parent | acf235d607879eb9542127eb0ddb42a250b5b850 (diff) | |
parent | 9b403b0f5f565674adce6c64b6942d36c3d6f7ec (diff) |
Merge pull request #1258 from hsyl20/wip/hsyl20/hscenv/unitstate
Unit fields moved from DynFlags to HscEnv
Diffstat (limited to 'haddock-api/src/Haddock/Options.hs')
-rw-r--r-- | haddock-api/src/Haddock/Options.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Options.hs b/haddock-api/src/Haddock/Options.hs index 5c9bf448..eda40935 100644 --- a/haddock-api/src/Haddock/Options.hs +++ b/haddock-api/src/Haddock/Options.hs @@ -45,7 +45,8 @@ import Data.Version import Control.Applicative import Distribution.Verbosity import GHC.Data.FastString -import GHC ( DynFlags, Module, moduleUnit, unitState ) +import GHC ( DynFlags, Module, moduleUnit ) +import GHC.Unit.State import Haddock.Types import Haddock.Utils import GHC.Unit.State @@ -370,16 +371,16 @@ optLast xs = Just (last xs) -- -- The @--package-name@ and @--package-version@ Haddock flags allow the user to -- specify this information manually and it is returned here if present. -modulePackageInfo :: DynFlags +modulePackageInfo :: UnitState -> [Flag] -- ^ Haddock flags are checked as they may contain -- the package name or version provided by the user -- which we prioritise -> Maybe Module -> (Maybe PackageName, Maybe Data.Version.Version) -modulePackageInfo _dflags _flags Nothing = (Nothing, Nothing) -modulePackageInfo dflags flags (Just modu) = +modulePackageInfo _unit_state _flags Nothing = (Nothing, Nothing) +modulePackageInfo unit_state flags (Just modu) = ( optPackageName flags <|> fmap unitPackageName pkgDb , optPackageVersion flags <|> fmap unitPackageVersion pkgDb ) where - pkgDb = lookupUnit (unitState dflags) (moduleUnit modu) + pkgDb = lookupUnit unit_state (moduleUnit modu) |