on master help sign in
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

commitb9dfd499dd1e4640b853235b5b850427f637a07a authorNeil Mitchell <35463327+neil-da@users.noreply.github.com> dateMon 6 May 2019, 18:35 (7 years ago) parentaf56be6
2 files changed+22−4
src/Development/IDE/Functions/Documentation.hs+2−1 src/Development/IDE/UtilGHC.hs+20−3
src/Development/IDE/Functions/Documentation.hs+2−1
@@ -13,9 +13,10 @@ import Data.Maybe
1313import qualified Data.Text as T
1414import Development.IDE.Functions.GHCError
1515import Development.IDE.Functions.SpanInfo
16−import Development.IDE.UtilGHC
1716import FastString
1817import GHC
18+import SrcLoc
19+
1920
2021getDocumentation
2122 :: Name -- ^ The name you want documentation for.
src/Development/IDE/UtilGHC.hs+20−3
@@ -24,7 +24,9 @@ module Development.IDE.UtilGHC(
2424 importGenerated,
2525 mkImport,
2626 runGhcFast,
27− Development.IDE.UtilGHC.RealLocated,
27+ setImports,
28+ setPackageState,
29+ setThisInstalledUnitId,
2830 modIsInternal
2931 ) where
3032
@@ -168,6 +170,23 @@ fakeLlvmConfig :: (LlvmTargets, LlvmPasses)
168170fakeLlvmConfig = ([], [])
169171
170172
173+setThisInstalledUnitId :: UnitId -> DynFlags -> DynFlags
174+setThisInstalledUnitId unitId dflags =
175+ dflags {thisInstalledUnitId = toInstalledUnitId unitId}
176+
177+setImports :: [FilePath] -> DynFlags -> DynFlags
178+setImports paths dflags = dflags { importPaths = paths }
179+
180+setPackageState :: PackageState -> DynFlags -> DynFlags
181+setPackageState state dflags =
182+ dflags
183+ { pkgDatabase = pkgStateDb state
184+ , pkgState = pkgStateState state
185+ , thisUnitIdInsts_ = pkgThisUnitIdInsts state
186+ }
187+
188+
189+
171190-- Orphan instances for types from the GHC API.
172191instance Show CoreModule where show = prettyPrint
173192instance NFData CoreModule where rnf !_ = ()
@@ -194,5 +213,3 @@ instance Show (GenLocated SrcSpan ModuleName) where show = prettyPrint
194213instance Show PackageName where show = prettyPrint
195214instance Show Packages.PackageState where show _ = "PackageState"
196215instance Show Name where show = prettyPrint
197−
198−type RealLocated = GenLocated RealSrcSpan