Minor IDE cleanups (#945)

* Kill RealLocated, it just duplicates something already in GHC

* Move some things back to UtilGHC, they are useful for setting DynFlags values
This commit is contained in:
Neil Mitchell 2019-05-06 18:35:43 +01:00 committed by GitHub
parent af56be6dfb
commit b9dfd499dd
2 changed files with 22 additions and 4 deletions

View File

@ -13,9 +13,10 @@ import Data.Maybe
import qualified Data.Text as T
import Development.IDE.Functions.GHCError
import Development.IDE.Functions.SpanInfo
import Development.IDE.UtilGHC
import FastString
import GHC
import SrcLoc
getDocumentation
:: Name -- ^ The name you want documentation for.

View File

@ -24,7 +24,9 @@ module Development.IDE.UtilGHC(
importGenerated,
mkImport,
runGhcFast,
Development.IDE.UtilGHC.RealLocated,
setImports,
setPackageState,
setThisInstalledUnitId,
modIsInternal
) where
@ -168,6 +170,23 @@ fakeLlvmConfig :: (LlvmTargets, LlvmPasses)
fakeLlvmConfig = ([], [])
setThisInstalledUnitId :: UnitId -> DynFlags -> DynFlags
setThisInstalledUnitId unitId dflags =
dflags {thisInstalledUnitId = toInstalledUnitId unitId}
setImports :: [FilePath] -> DynFlags -> DynFlags
setImports paths dflags = dflags { importPaths = paths }
setPackageState :: PackageState -> DynFlags -> DynFlags
setPackageState state dflags =
dflags
{ pkgDatabase = pkgStateDb state
, pkgState = pkgStateState state
, thisUnitIdInsts_ = pkgThisUnitIdInsts state
}
-- Orphan instances for types from the GHC API.
instance Show CoreModule where show = prettyPrint
instance NFData CoreModule where rnf !_ = ()
@ -194,5 +213,3 @@ instance Show (GenLocated SrcSpan ModuleName) where show = prettyPrint
instance Show PackageName where show = prettyPrint
instance Show Packages.PackageState where show _ = "PackageState"
instance Show Name where show = prettyPrint
type RealLocated = GenLocated RealSrcSpan