Store a SrcSpan instead of a SrcLoc inside a Name
[ghc-hetmet.git] / compiler / main / GHC.hs
index 35e4d9d..55c1e5f 100644 (file)
@@ -15,10 +15,11 @@ module GHC (
 
        -- * Flags and settings
        DynFlags(..), DynFlag(..), Severity(..), HscTarget(..), dopt,
-        GhcMode(..), GhcLink(..),
+        GhcMode(..), GhcLink(..), defaultObjectTarget,
        parseDynamicFlags,
        getSessionDynFlags,
        setSessionDynFlags,
+        parseStaticFlags,
 
        -- * Targets
        Target(..), TargetId(..), Phase,
@@ -78,11 +79,15 @@ module GHC (
        typeKind,
        parseName,
        RunResult(..),  
-       runStmt, stepStmt, -- traceStmt,
-        resume,  stepResume, -- traceResume,
-        Resume(resumeStmt, resumeThreadId, resumeBreakInfo, resumeSpan),
+       runStmt, SingleStep(..),
+        resume,
+        Resume(resumeStmt, resumeThreadId, resumeBreakInfo, resumeSpan,
+               resumeHistory, resumeHistoryIx),
+        History(historyBreakInfo), getHistorySpan,
         getResumeContext,
         abandon, abandonAll,
+        InteractiveEval.back,
+        InteractiveEval.forward,
        showModule,
         isModuleInterpreted,
        compileExpr, HValue, dynCompileExpr,
@@ -105,7 +110,7 @@ module GHC (
 
        -- ** Names
        Name, 
-       nameModule, pprParenSymName, nameSrcLoc,
+       nameModule, pprParenSymName, nameSrcSpan,
        NamedThing(..),
        RdrName(Qual,Unqual),
        
@@ -170,7 +175,7 @@ module GHC (
         mkSrcLoc, isGoodSrcLoc,
        srcLocFile, srcLocLine, srcLocCol,
         SrcSpan,
-        mkSrcSpan, srcLocSpan,
+        mkSrcSpan, srcLocSpan, isGoodSrcSpan,
         srcSpanStart, srcSpanEnd,
        srcSpanFile, 
         srcSpanStartLine, srcSpanEndLine, 
@@ -227,10 +232,13 @@ import Finder
 import HscMain          ( newHscEnv, hscFileCheck, HscChecked(..) )
 import HscTypes
 import DynFlags
+import StaticFlags
 import SysTools     ( initSysTools, cleanTempFiles, cleanTempFilesExcept,
                       cleanTempDirs )
 import Module
 import UniqFM
+import UniqSet
+import Unique
 import PackageConfig
 import FiniteMap
 import Panic
@@ -332,6 +340,7 @@ newSession mb_top_dir = do
   modifyMVar_ interruptTargetThread (return . (main_thread :))
   installSignalHandlers
 
+  initStaticOpts
   dflags0 <- initSysTools mb_top_dir defaultDynFlags
   dflags  <- initDynFlags dflags0
   env <- newHscEnv dflags
@@ -1748,10 +1757,14 @@ getBindings s = withSession s $ \hsc_env ->
    -- we have to implement the shadowing behaviour of ic_tmp_ids here
    -- (see InteractiveContext) and the quickest way is to use an OccEnv.
    let 
-       tmp_ids = reverse (ic_tmp_ids (hsc_IC hsc_env))
-       env = mkOccEnv [ (nameOccName (idName id), id) | id <- tmp_ids ]
+       tmp_ids = ic_tmp_ids (hsc_IC hsc_env)
+       filtered = foldr f (const []) tmp_ids emptyUniqSet
+       f id rest set 
+           | uniq `elementOfUniqSet` set = rest set
+           | otherwise  = AnId id : rest (addOneToUniqSet set uniq)
+           where uniq = getUnique (nameOccName (idName id))
    in
-   return (map AnId (occEnvElts env))
+   return filtered
 
 getPrintUnqual :: Session -> IO PrintUnqualified
 getPrintUnqual s = withSession s (return . icPrintUnqual . hsc_IC)