diff options
author | Antoine Gourlay <antoine@gourlay.fr> | 2015-04-02 16:08:25 +0200 |
---|---|---|
committer | Antoine Gourlay <antoine@gourlay.fr> | 2015-04-02 19:13:34 +0200 |
commit | 83ea1250882108c82e0e47adbebca28f907de4f4 (patch) | |
tree | e20ed191105462abbde829b78e043ec2aceb65e5 /src | |
parent | 2ce7ead5390368a2a6b7534f0ebfa20805b79221 (diff) | |
download | scala-83ea1250882108c82e0e47adbebca28f907de4f4.tar.gz scala-83ea1250882108c82e0e47adbebca28f907de4f4.tar.bz2 scala-83ea1250882108c82e0e47adbebca28f907de4f4.zip |
fix scaladoc issue with parsing of empty tags
Consider the following code:
/**
* @see
* @deprecated
*/
object Foo
The comment parser properly parsed the body of the 'see' tag as
empty, but not the one of 'deprecated': it supposedly contains a single
character, a newline '\n', which is wrong.
This always happened to the last tag in the list; it is always appended
a new line (whether empty or not), which breaks formatting (and things
later on that test if a body is empty of not).
Diffstat (limited to 'src')
-rwxr-xr-x | src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala index d31b877262..42ca98dc7a 100755 --- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala +++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala @@ -281,13 +281,16 @@ trait CommentFactoryBase { this: MemberLookupBase => parse0(docBody, tags + (key -> value), Some(key), ls, inCodeBlock) case line :: ls if (lastTagKey.isDefined) => - val key = lastTagKey.get - val value = - ((tags get key): @unchecked) match { - case Some(b :: bs) => (b + endOfLine + line) :: bs - case None => oops("lastTagKey set when no tag exists for key") - } - parse0(docBody, tags + (key -> value), lastTagKey, ls, inCodeBlock) + val newtags = if (!line.isEmpty) { + val key = lastTagKey.get + val value = + ((tags get key): @unchecked) match { + case Some(b :: bs) => (b + endOfLine + line) :: bs + case None => oops("lastTagKey set when no tag exists for key") + } + tags + (key -> value) + } else tags + parse0(docBody, newtags, lastTagKey, ls, inCodeBlock) case line :: ls => if (docBody.length > 0) docBody append endOfLine |