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

View File

@ -18,7 +18,7 @@ import Data.Maybe (isJust, fromJust)
import Distribution.PackageDescription (PackageDescription) import Distribution.PackageDescription (PackageDescription)
import DynFlags (dopt_set) import DynFlags (dopt_set)
import Exception (ghandle, SomeException(..)) 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 qualified GHC as G
import Language.Haskell.GhcMod.CabalApi import Language.Haskell.GhcMod.CabalApi
import Language.Haskell.GhcMod.ErrMsg import Language.Haskell.GhcMod.ErrMsg
@ -141,7 +141,7 @@ modifyFlags d0 idirs depPkgs splice build
| otherwise = d3 | otherwise = d3
setSplice :: DynFlags -> DynFlags 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 , showDocWith
, GapThing(..) , GapThing(..)
, fromTyThing , fromTyThing
, dumpSplicesFlag
) where ) where
import Control.Applicative hiding (empty) import Control.Applicative hiding (empty)
@ -348,3 +349,12 @@ fromTyThing (ADataCon d) = GtA $ dataConRepType d
#endif #endif
fromTyThing (ATyCon t) = GtT t fromTyThing (ATyCon t) = GtT t
fromTyThing _ = GtN fromTyThing _ = GtN
----------------------------------------------------------------
#if __GLASGOW_HASKELL__ >= 707
dumpSplicesFlag :: DumpFlag
#else
dumpSplicesFlag :: DynFlag
#endif
dumpSplicesFlag = Opt_D_dump_splices