summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-05-28 15:59:26 +0200
committerBen Gamari <ben@well-typed.com>2019-06-03 23:42:12 -0400
commita0646db3e2ac65c348141b2fe92de4ca6a6573a0 (patch)
treeaf29501db5a0e520c2586ec5edf03fccf93412b2
parent0072499f01b5374177dff8cf6c95d16aabc44cff (diff)
downloadhaskell-a0646db3e2ac65c348141b2fe92de4ca6a6573a0.tar.gz
Improve targetContents code docs
-rw-r--r--compiler/main/DriverPipeline.hs8
-rw-r--r--compiler/main/GhcMake.hs1
-rw-r--r--compiler/main/HscTypes.hs6
3 files changed, 9 insertions, 6 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index f977f3448d..8ffeb5e908 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -52,7 +52,7 @@ import DynFlags
import Config
import Panic
import Util
-import StringBuffer ( StringBuffer, hGetStringBuffer, hPutStringBuffer )
+import StringBuffer ( hGetStringBuffer, hPutStringBuffer )
import BasicTypes ( SuccessFlag(..) )
import Maybes ( expectJust )
import SrcLoc
@@ -90,8 +90,8 @@ import Data.Time ( UTCTime )
preprocess :: HscEnv
-> FilePath -- ^ input filename
- -> Maybe StringBuffer
- -- ^ optional buffer to use instead of reading input file
+ -> Maybe InputFileBuffer
+ -- ^ optional buffer to use instead of reading the input file
-> Maybe Phase -- ^ starting phase
-> IO (Either ErrorMessages (DynFlags, FilePath))
preprocess hsc_env input_fn mb_input_buf mb_phase =
@@ -576,7 +576,7 @@ doLink dflags stop_phase o_files
runPipeline
:: Phase -- ^ When to stop
-> HscEnv -- ^ Compilation environment
- -> (FilePath, Maybe StringBuffer, Maybe PhasePlus)
+ -> (FilePath, Maybe InputFileBuffer, Maybe PhasePlus)
-- ^ Pipeline input file name, optional
-- buffer and maybe -x suffix
-> Maybe FilePath -- ^ original basename (if different from ^^^)
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index d836cf28ff..d052b71895 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -2479,6 +2479,7 @@ getPreprocessedImports
-> FilePath
-> Maybe Phase
-> Maybe (StringBuffer, UTCTime)
+ -- ^ optional source code buffer and modification time
-> ExceptT ErrorMessages IO PreprocessedImports
getPreprocessedImports hsc_env src_fn mb_phase maybe_buf = do
(pi_local_dflags, pi_hspp_fn)
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index d43f5c5815..ce97e3ae02 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -13,7 +13,7 @@ module HscTypes (
-- * compilation state
HscEnv(..), hscEPS,
FinderCache, FindResult(..), InstalledFindResult(..),
- Target(..), TargetId(..), pprTarget, pprTargetId,
+ Target(..), TargetId(..), InputFileBuffer, pprTarget, pprTargetId,
HscStatus(..),
IServ(..),
@@ -503,7 +503,7 @@ data Target
= Target {
targetId :: TargetId, -- ^ module or filename
targetAllowObjCode :: Bool, -- ^ object code allowed?
- targetContents :: Maybe (StringBuffer,UTCTime)
+ targetContents :: Maybe (InputFileBuffer, UTCTime)
-- ^ Optional in-memory buffer containing the source code GHC should
-- use for this target instead of reading it from disk.
--
@@ -526,6 +526,8 @@ data TargetId
-- should be determined from the suffix of the filename.
deriving Eq
+type InputFileBuffer = StringBuffer
+
pprTarget :: Target -> SDoc
pprTarget (Target id obj _) =
(if obj then char '*' else empty) <> pprTargetId id