create valid DynFlags argument for newHscEnv when using GHC >= 7.2

This commit is contained in:
Jeremy Shaw 2012-03-19 22:19:37 +00:00
parent 2893cdd167
commit 26d09ce631
2 changed files with 11 additions and 1 deletions

View File

@ -57,3 +57,7 @@ library
ghc >= 6.10, ghc >= 6.10,
ghc-prim ghc-prim
if impl(ghc >= 7.2)
build-depends: ghc-paths

View File

@ -86,6 +86,10 @@ import Foreign.C.String ( CString, withCString, peekCString )
#if !MIN_VERSION_ghc(7,2,0) #if !MIN_VERSION_ghc(7,2,0)
import GHC ( defaultCallbacks ) import GHC ( defaultCallbacks )
#else
import DynFlags (defaultDynFlags, initDynFlags)
import GHC.Paths (libdir)
import SysTools (initSysTools)
#endif #endif
import GHC.Ptr ( Ptr(..), nullPtr ) import GHC.Ptr ( Ptr(..), nullPtr )
#if !MIN_VERSION_ghc(7,4,1) #if !MIN_VERSION_ghc(7,4,1)
@ -107,7 +111,9 @@ readBinIface' :: FilePath -> IO ModIface
readBinIface' hi_path = do readBinIface' hi_path = do
-- kludgy as hell -- kludgy as hell
#if MIN_VERSION_ghc(7,2,0) #if MIN_VERSION_ghc(7,2,0)
e <- newHscEnv undefined mySettings <- initSysTools (Just libdir) -- how should we really set the top dir?
dflags <- initDynFlags (defaultDynFlags mySettings)
e <- newHscEnv dflags
#else #else
e <- newHscEnv defaultCallbacks undefined e <- newHscEnv defaultCallbacks undefined
#endif #endif