X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FName.lhs;h=e2f272370b5b3a0c612d40c1f9744e36b528c72f;hb=3b1438a9757639d7f37f10e1237e2369ca0ebe4a;hp=488dbca1c81ab8cc36c2b0f5c32d35a655dc6552;hpb=37df27c6f21452c60c45b5cf6defc9003a41da15;p=ghc-hetmet.git diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs index 488dbca..e2f2723 100644 --- a/compiler/basicTypes/Name.lhs +++ b/compiler/basicTypes/Name.lhs @@ -30,7 +30,7 @@ module Name ( tidyNameOcc, hashName, localiseName, - nameSrcLoc, nameSrcSpan, + nameSrcLoc, nameSrcSpan, pprNameLoc, isSystemName, isInternalName, isExternalName, isTyVarName, isTyConName, isWiredInName, isBuiltInSyntax, @@ -401,6 +401,13 @@ ppr_occ_name occ = ftext (occNameFS occ) -- In code style, we Z-encode the strings. The results of Z-encoding each FastString are -- cached behind the scenes in the FastString implementation. ppr_z_occ_name occ = ftext (zEncodeFS (occNameFS occ)) + +-- Prints "Defined at " or "Defined in " information for a Name. +pprNameLoc :: Name -> SDoc +pprNameLoc name + | isGoodSrcSpan loc = pprDefnLoc loc + | otherwise = ptext SLIT("Defined in ") <> ppr (nameModule name) + where loc = nameSrcSpan name \end{code} %************************************************************************