aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-10-27 19:59:04 +0000
committerDavid Waern <david.waern@gmail.com>2008-10-27 19:59:04 +0000
commit212a79093d662ba4f019a87ad9e4a55e4c2b065a (patch)
tree73abe9ac0cac6dbace46aab6241b9a6022d0d7f0
parent4bf839ae83d40e6c41b99889152dac26af5c55e4 (diff)
Make named doc comments into ExportDoc instead of ExportDecl
Fixes a crash when processing modules without export lists containing named docs.
-rw-r--r--src/Haddock/Interface/Create.hs1
-rw-r--r--tests/tests/NamedDoc.hs4
-rw-r--r--tests/tests/NamedDoc.html.ref99
3 files changed, 104 insertions, 0 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 25f04d31..b7c82267 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -411,6 +411,7 @@ fullContentsOfThisModule :: Module -> [DeclInfo] -> [ExportItem Name]
fullContentsOfThisModule module_ decls = catMaybes (map mkExportItem decls)
where
mkExportItem (L _ (DocD (DocGroup lev doc)), _, _) = Just $ ExportGroup lev "" doc
+ mkExportItem (L _ (DocD (DocCommentNamed _ doc)), _, _) = Just $ ExportDoc doc
mkExportItem (decl, doc, subs) = Just $ ExportDecl decl doc subdocs []
where subdocs = [ (n, doc) | (n, Just doc) <- subs ]
diff --git a/tests/tests/NamedDoc.hs b/tests/tests/NamedDoc.hs
new file mode 100644
index 00000000..7c04ba72
--- /dev/null
+++ b/tests/tests/NamedDoc.hs
@@ -0,0 +1,4 @@
+module NamedDoc where
+
+-- $foo bar
+
diff --git a/tests/tests/NamedDoc.html.ref b/tests/tests/NamedDoc.html.ref
new file mode 100644
index 00000000..84b02e97
--- /dev/null
+++ b/tests/tests/NamedDoc.html.ref
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--Rendered using the Haskell Html Library v0.2-->
+<HTML
+><HEAD
+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"
+><TITLE
+>NamedDoc</TITLE
+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"
+><SCRIPT SRC="haddock-util.js" TYPE="text/javascript"
+></SCRIPT
+></HEAD
+><BODY
+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
+><TR
+><TD CLASS="topbar"
+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
+><TR
+><TD
+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "
+></TD
+><TD CLASS="title"
+></TD
+><TD CLASS="topbut"
+><A HREF="index.html"
+>Contents</A
+></TD
+><TD CLASS="topbut"
+><A HREF="doc-index.html"
+>Index</A
+></TD
+></TR
+></TABLE
+></TD
+></TR
+><TR
+><TD CLASS="modulebar"
+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
+><TR
+><TD
+><FONT SIZE="6"
+>NamedDoc</FONT
+></TD
+></TR
+></TABLE
+></TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="section1"
+>Synopsis</TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="body"
+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"
+></TABLE
+></TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="section1"
+>Documentation</TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="doc"
+>bar
+</TD
+></TR
+><TR
+><TD CLASS="s15"
+></TD
+></TR
+><TR
+><TD CLASS="botbar"
+>Produced by <A HREF="http://www.haskell.org/haddock/"
+>Haddock</A
+> version 2.3.0</TD
+></TR
+></TABLE
+></BODY
+></HTML
+>