X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FRdrName.lhs;h=f1ab0af8bca474e7aff287464238675e226f0751;hb=9bbcd77cf9b66940058dbea1827db594e8ff6d7f;hp=2090beadfa51ce72116146cfdfba15d80a7b6b97;hpb=5ad61e1470db6dbc8279569c5ad1cc093f753ac0;p=ghc-hetmet.git diff --git a/compiler/basicTypes/RdrName.lhs b/compiler/basicTypes/RdrName.lhs index 2090bea..f1ab0af8 100644 --- a/compiler/basicTypes/RdrName.lhs +++ b/compiler/basicTypes/RdrName.lhs @@ -35,7 +35,7 @@ module RdrName ( Provenance(..), pprNameProvenance, Parent(..), ImportSpec(..), ImpDeclSpec(..), ImpItemSpec(..), - importSpecLoc, importSpecModule + importSpecLoc, importSpecModule, isExplicitItem ) where #include "HsVersions.h" @@ -302,6 +302,7 @@ data GlobalRdrElt } data Parent = NoParent | ParentIs Name + deriving (Eq) instance Outputable Parent where ppr NoParent = empty @@ -309,8 +310,20 @@ instance Outputable Parent where plusParent :: Parent -> Parent -> Parent -plusParent NoParent rel = ASSERT( case rel of { NoParent -> True; other -> False } ) NoParent -plusParent (ParentIs n) rel = ASSERT( case rel of { ParentIs m -> n==m; other -> False } ) ParentIs n +plusParent p1 p2 = ASSERT2( p1 == p2, parens (ppr p1) <+> parens (ppr p2) ) + p1 + +{- Why so complicated? -=chak +plusParent :: Parent -> Parent -> Parent +plusParent NoParent rel = + ASSERT2( case rel of { NoParent -> True; other -> False }, + ptext SLIT("plusParent[NoParent]: ") <+> ppr rel ) + NoParent +plusParent (ParentIs n) rel = + ASSERT2( case rel of { ParentIs m -> n==m; other -> False }, + ptext SLIT("plusParent[ParentIs]:") <+> ppr n <> comma <+> ppr rel ) + ParentIs n + -} emptyGlobalRdrEnv = emptyOccEnv @@ -527,6 +540,10 @@ importSpecLoc (ImpSpec _ item) = is_iloc item importSpecModule :: ImportSpec -> ModuleName importSpecModule is = is_mod (is_decl is) +isExplicitItem :: ImpItemSpec -> Bool +isExplicitItem ImpAll = False +isExplicitItem (ImpSome {is_explicit = exp}) = exp + -- Note [Comparing provenance] -- Comparison of provenance is just used for grouping -- error messages (in RnEnv.warnUnusedBinds)