-import Bag ( unitBag, emptyBag, listToBag )
-
-import Distribution.Compiler
-
-import TRACE
-
-import EXCEPTION ( throwDyn )
-import IO
-import List
-
-#if __GLASGOW_HASKELL__ >= 601
-import System.IO ( openBinaryFile )
-#else
-import IOExts ( openFileEx, IOModeEx(..) )
-#endif
-
-#if __GLASGOW_HASKELL__ < 601
-openBinaryFile fp mode = openFileEx fp (BinaryMode mode)
-#endif
-
--- getImportsFromFile is careful to close the file afterwards, otherwise
--- we can end up with a large number of open handles before the garbage
--- collector gets around to closing them.
-getImportsFromFile :: DynFlags -> FilePath
- -> IO ([Located Module], [Located Module], Located Module)
-getImportsFromFile dflags filename = do
- buf <- hGetStringBuffer filename
- getImports dflags buf filename
-
-getImports :: DynFlags -> StringBuffer -> FilePath
- -> IO ([Located Module], [Located Module], Located Module)
-getImports dflags buf filename = do
+import Maybes
+import Bag ( emptyBag, listToBag )
+
+import Exception
+import Control.Monad
+import System.Exit
+import System.IO
+import Data.List
+
+getImports :: DynFlags -> StringBuffer -> FilePath -> FilePath
+ -> IO ([Located ModuleName], [Located ModuleName], Located ModuleName)
+getImports dflags buf filename source_filename = do