adding dumpSplicesFlag.

This commit is contained in:
Kazu Yamamoto 2014-03-27 20:54:18 +09:00
parent 5dbea7b909
commit f7f1e081c5
3 changed files with 16 additions and 5 deletions

View File

@ -10,8 +10,9 @@ import Bag (Bag, bagToList)
import Control.Applicative ((<$>))
import Data.IORef (IORef, newIORef, readIORef, writeIORef, modifyIORef)
import Data.Maybe (fromMaybe)
import DynFlags (dopt)
import ErrUtils (ErrMsg, errMsgShortDoc, errMsgExtraInfo)
import GHC (Ghc, DynFlag(Opt_D_dump_splices), DynFlags, SrcSpan, Severity(SevError))
import GHC (Ghc, DynFlags, SrcSpan, Severity(SevError))
import qualified GHC as G
import HscTypes (SourceError, srcErrorMessages)
import Language.Haskell.GhcMod.Doc (showUnqualifiedPage)
@ -81,8 +82,8 @@ ppMsg spn sev dflag ls msg = prefix ++ cts
where
cts = showMsg dflag ls msg
defaultPrefix
| G.dopt Opt_D_dump_splices dflag = ""
| otherwise = "Dummy:0:0:Error:"
| dopt Gap.dumpSplicesFlag dflag = ""
| otherwise = "Dummy:0:0:Error:"
prefix = fromMaybe defaultPrefix $ do
(line,col,_,_) <- Gap.getSrcSpan spn
file <- normalise <$> Gap.getSrcFile spn

View File

@ -18,7 +18,7 @@ import Data.Maybe (isJust, fromJust)
import Distribution.PackageDescription (PackageDescription)
import DynFlags (dopt_set)
import Exception (ghandle, SomeException(..))
import GHC (Ghc, GhcMonad, DynFlags(..), DynFlag(Opt_D_dump_splices), GhcLink(..), HscTarget(..))
import GHC (Ghc, GhcMonad, DynFlags(..), GhcLink(..), HscTarget(..))
import qualified GHC as G
import Language.Haskell.GhcMod.CabalApi
import Language.Haskell.GhcMod.ErrMsg
@ -141,7 +141,7 @@ modifyFlags d0 idirs depPkgs splice build
| otherwise = d3
setSplice :: DynFlags -> DynFlags
setSplice dflag = dopt_set dflag Opt_D_dump_splices
setSplice dflag = dopt_set dflag Gap.dumpSplicesFlag
----------------------------------------------------------------

View File

@ -28,6 +28,7 @@ module Language.Haskell.GhcMod.Gap (
, showDocWith
, GapThing(..)
, fromTyThing
, dumpSplicesFlag
) where
import Control.Applicative hiding (empty)
@ -348,3 +349,12 @@ fromTyThing (ADataCon d) = GtA $ dataConRepType d
#endif
fromTyThing (ATyCon t) = GtT t
fromTyThing _ = GtN
----------------------------------------------------------------
#if __GLASGOW_HASKELL__ >= 707
dumpSplicesFlag :: DumpFlag
#else
dumpSplicesFlag :: DynFlag
#endif
dumpSplicesFlag = Opt_D_dump_splices