"Dummy:0:0" -> "<filename>:0:0".

This commit is contained in:
Kazu Yamamoto 2012-12-07 14:27:02 +09:00
parent 5189977cbc
commit c7bd0d8863
2 changed files with 6 additions and 3 deletions

View File

@ -18,7 +18,7 @@ checkSyntax opt file = unlines <$> check opt file
----------------------------------------------------------------
check :: Options -> String -> IO [String]
check opt fileName = withGHC $ checkIt `gcatch` handleErrMsg
check opt fileName = withGHC' fileName $ checkIt `gcatch` handleErrMsg
where
checkIt = do
(file,readLog) <- initializeGHC opt fileName options True

View File

@ -15,13 +15,16 @@ import Types
----------------------------------------------------------------
withGHC :: Alternative m => Ghc (m a) -> IO (m a)
withGHC body = ghandle ignore $ runGhc (Just libdir) $ do
withGHC = withGHC' "Dummy"
withGHC' :: Alternative m => FilePath -> Ghc (m a) -> IO (m a)
withGHC' file body = ghandle ignore $ runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
defaultCleanupHandler dflags body
where
ignore :: Alternative m => SomeException -> IO (m a)
ignore e = do
hPutStr stderr "Dummy:0:0:Error:"
hPutStr stderr $ file ++ ":0:0:Error:"
hPrint stderr e
exitSuccess