Defining checkSlowAndSet.
This commit is contained in:
parent
83c6ba3032
commit
8d7b0d365b
7
Check.hs
7
Check.hs
@ -23,12 +23,7 @@ check opt cradle fileName = withGHC fileName $ checkIt `gcatch` handleErrMsg
|
||||
checkIt = do
|
||||
readLog <- initializeFlagsWithCradle opt cradle options True
|
||||
setTargetFile fileName
|
||||
-- To check TH, a session module graph is necessary.
|
||||
-- "load" sets a session module graph using "depanal".
|
||||
-- But we have to set "-fno-code" to DynFlags before "load".
|
||||
-- So, this is necessary redundancy.
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
when slow setSlowDynFlags
|
||||
checkSlowAndSet
|
||||
void $ load LoadAllTargets
|
||||
liftIO readLog
|
||||
options
|
||||
|
11
GHCApi.hs
11
GHCApi.hs
@ -5,7 +5,7 @@ module GHCApi (
|
||||
, initializeFlagsWithCradle
|
||||
, setTargetFile
|
||||
, getDynamicFlags
|
||||
, setSlowDynFlags
|
||||
, checkSlowAndSet
|
||||
) where
|
||||
|
||||
import CabalApi
|
||||
@ -122,6 +122,15 @@ setSlowDynFlags :: Ghc ()
|
||||
setSlowDynFlags = (flip setFastOrNot False <$> getSessionDynFlags)
|
||||
>>= void . setSessionDynFlags
|
||||
|
||||
-- To check TH, a session module graph is necessary.
|
||||
-- "load" sets a session module graph using "depanal".
|
||||
-- But we have to set "-fno-code" to DynFlags before "load".
|
||||
-- So, this is necessary redundancy.
|
||||
checkSlowAndSet :: Ghc ()
|
||||
checkSlowAndSet = do
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
when slow setSlowDynFlags
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
modifyFlagsWithOpts :: DynFlags -> [String] -> Ghc DynFlags
|
||||
|
16
Info.hs
16
Info.hs
@ -4,7 +4,7 @@
|
||||
module Info (infoExpr, typeExpr) where
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Monad (when)
|
||||
import Control.Monad (void)
|
||||
import CoreUtils
|
||||
import Data.Function
|
||||
import Data.Generics
|
||||
@ -144,18 +144,16 @@ inModuleContext opt cradle fileName modstr action errmsg =
|
||||
withGHCDummyFile (valid ||> invalid ||> return errmsg)
|
||||
where
|
||||
valid = do
|
||||
_ <- initializeFlagsWithCradle opt cradle ["-w"] False
|
||||
void $ initializeFlagsWithCradle opt cradle ["-w"] False
|
||||
setTargetFile fileName
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
when slow setSlowDynFlags
|
||||
_ <- load LoadAllTargets
|
||||
checkSlowAndSet
|
||||
void $ load LoadAllTargets
|
||||
doif setContextFromTarget action
|
||||
invalid = do
|
||||
_ <- initializeFlagsWithCradle opt cradle ["-w"] False
|
||||
void $ initializeFlagsWithCradle opt cradle ["-w"] False
|
||||
setTargetBuffer
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
when slow setSlowDynFlags
|
||||
_ <- load LoadAllTargets
|
||||
checkSlowAndSet
|
||||
void $ load LoadAllTargets
|
||||
doif setContextFromTarget action
|
||||
setTargetBuffer = do
|
||||
modgraph <- depanal [mkModuleName modstr] True
|
||||
|
Loading…
Reference in New Issue
Block a user