summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-05-28 15:59:26 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-05-30 16:44:08 -0400
commitd278477123fe9270e5f21db722b7295371a097e2 (patch)
treeb9d4806f067927908f561cfcc9c108fed5efe4fe
parent98e39818f5f66b9a6b95ce7b484b54dbc68e454e (diff)
downloadhaskell-d278477123fe9270e5f21db722b7295371a097e2.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 78e4a810d7..d2814b71f2 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -51,7 +51,7 @@ import ErrUtils
import DynFlags
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 =
@@ -579,7 +579,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 c0048c6075..a748cc668b 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -2529,6 +2529,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 e75b2457f0..dba39c97f0 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(..),
@@ -511,7 +511,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.
--
@@ -534,6 +534,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