diff options
author | simonpj@microsoft.com <unknown> | 2008-10-03 13:53:34 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2008-10-03 13:53:34 +0000 |
commit | 66579ff945831c5fc9a17c58c722ff01f2268d76 (patch) | |
tree | e0f632b523acf046e38d1cc67ea74a12f29a6993 /compiler/ghci | |
parent | 766b34f81d81d009f1070e297756423fbadbd421 (diff) | |
download | haskell-66579ff945831c5fc9a17c58c722ff01f2268d76.tar.gz |
Add ASSERTs to all calls of nameModule
nameModule fails on an InternalName. These ASSERTS tell you
which call failed.
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/ByteCodeLink.lhs | 2 | ||||
-rw-r--r-- | compiler/ghci/InteractiveUI.hs | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index 54dff1d498..fabd5d1785 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -265,7 +265,7 @@ nameToCLabel n suffix else qual_name where pkgid = modulePackageId mod - mod = nameModule n + mod = ASSERT( isExternalName n ) nameModule n package_part = unpackFS (zEncodeFS (packageIdFS (modulePackageId mod))) module_part = unpackFS (zEncodeFS (moduleNameFS (moduleName mod))) occ_part = unpackFS (zEncodeFS (occNameFS (nameOccName n))) diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index e0dd5cc17c..b1baecd69a 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -1088,7 +1088,8 @@ checkModule m = do case GHC.moduleInfo r of cm | Just scope <- GHC.modInfoTopLevelScope cm -> let - (local,global) = partition ((== modl) . GHC.moduleName . GHC.nameModule) scope + (local,global) = ASSERT( all isExternalName scope ) + partition ((== modl) . GHC.moduleName . GHC.nameModule) scope in (text "global names: " <+> ppr global) $$ (text "local names: " <+> ppr local) @@ -1275,7 +1276,8 @@ browseModule bang modl exports_only = do -- We would like to improve this; see #1799. sorted_names = loc_sort local ++ occ_sort external where - (local,external) = partition ((==modl) . nameModule) names + (local,external) = ASSERT( all isExternalName names ) + partition ((==modl) . nameModule) names occ_sort = sortBy (compare `on` nameOccName) -- try to sort by src location. If the first name in -- our list has a good source location, then they all should. @@ -1896,7 +1898,7 @@ wantNameFromInterpretedModule noCanDo str and_then = case names of [] -> return () (n:_) -> do - let modl = GHC.nameModule n + let modl = ASSERT( isExternalName n ) GHC.nameModule n if not (GHC.isExternalName n) then noCanDo n $ ppr n <> text " is not defined in an interpreted module" @@ -2068,7 +2070,8 @@ breakSwitch (arg1:rest) wantNameFromInterpretedModule noCanDo arg1 $ \name -> do let loc = GHC.srcSpanStart (GHC.nameSrcSpan name) if GHC.isGoodSrcLoc loc - then findBreakAndSet (GHC.nameModule name) $ + then ASSERT( isExternalName name ) + findBreakAndSet (GHC.nameModule name) $ findBreakByCoord (Just (GHC.srcLocFile loc)) (GHC.srcLocLine loc, GHC.srcLocCol loc) @@ -2215,7 +2218,8 @@ list2 [arg] = do let loc = GHC.srcSpanStart (GHC.nameSrcSpan name) if GHC.isGoodSrcLoc loc then do - tickArray <- getTickArray (GHC.nameModule name) + tickArray <- ASSERT( isExternalName name ) + getTickArray (GHC.nameModule name) let mb_span = findBreakByCoord (Just (GHC.srcLocFile loc)) (GHC.srcLocLine loc, GHC.srcLocCol loc) tickArray |