X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Frename%2FRnHsDoc.hs;h=4d10edca5e90622260cf94becbab9f63bd55f456;hb=8ec978161d50e476e327b59bdf1a2d5e57705609;hp=f3d36907f4e4534b564676992670c145ddbcd574;hpb=5ad61e1470db6dbc8279569c5ad1cc093f753ac0;p=ghc-hetmet.git diff --git a/compiler/rename/RnHsDoc.hs b/compiler/rename/RnHsDoc.hs index f3d3690..4d10edc 100644 --- a/compiler/rename/RnHsDoc.hs +++ b/compiler/rename/RnHsDoc.hs @@ -1,33 +1,48 @@ -module RnHsDoc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc, rnMbHsDoc ) where -import TcRnMonad ( RnM ) +module RnHsDoc ( rnHaddock, rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where + +import TcRnTypes import RnEnv ( dataTcOccs, lookupGreRn_maybe ) -import HsDoc ( HsDoc(..) ) +import HsSyn -import RdrName ( RdrName, isRdrDataCon, isRdrTc, gre_name ) +import RdrName ( RdrName, gre_name ) import Name ( Name ) import SrcLoc ( Located(..) ) import Outputable ( ppr, defaultUserStyle ) -import Data.List ( (\\) ) -import Debug.Trace ( trace ) +rnHaddock :: HaddockModInfo RdrName -> Maybe (HsDoc RdrName) + -> TcGblEnv -> RnM TcGblEnv +rnHaddock module_info maybe_doc tcg_env + = do { rn_module_doc <- rnMbHsDoc maybe_doc ; + + -- Rename the Haddock module info + ; rn_description <- rnMbHsDoc (hmi_description module_info) + ; let { rn_module_info = module_info { hmi_description = rn_description } } + + ; return (tcg_env { tcg_doc = rn_module_doc, + tcg_hmi = rn_module_info }) } + +rnMbHsDoc :: Maybe (HsDoc RdrName) -> RnM (Maybe (HsDoc Name)) rnMbHsDoc mb_doc = case mb_doc of Just doc -> do doc' <- rnHsDoc doc return (Just doc') Nothing -> return Nothing +rnMbLHsDoc :: Maybe (LHsDoc RdrName) -> RnM (Maybe (LHsDoc Name)) rnMbLHsDoc mb_doc = case mb_doc of Just doc -> do doc' <- rnLHsDoc doc return (Just doc') Nothing -> return Nothing +rnLHsDoc :: LHsDoc RdrName -> RnM (LHsDoc Name) rnLHsDoc (L pos doc) = do doc' <- rnHsDoc doc return (L pos doc') +ids2string :: [RdrName] -> String ids2string [] = [] ids2string (x:_) = show $ ppr x defaultUserStyle @@ -85,4 +100,6 @@ rnHsDoc doc = case doc of DocURL str -> return (DocURL str) + DocPic str -> return (DocPic str) + DocAName str -> return (DocAName str)