summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/DocComments.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-04-09 15:56:35 +0000
committerMartin Odersky <odersky@gmail.com>2010-04-09 15:56:35 +0000
commitc46a200d8cead57030d007ca841e23ccdcd7bd55 (patch)
tree9bcbd1c4d9d07f13fd49674225b2853153c007cd /src/compiler/scala/tools/nsc/ast/DocComments.scala
parent457a672d6f3b626a453fcb31e614f12e17419dd7 (diff)
downloadscala-c46a200d8cead57030d007ca841e23ccdcd7bd55.tar.gz
scala-c46a200d8cead57030d007ca841e23ccdcd7bd55.tar.bz2
scala-c46a200d8cead57030d007ca841e23ccdcd7bd55.zip
Fixed problem in scaladoc which did not expand ...
Fixed problem in scaladoc which did not expand variables in top-level classes.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/DocComments.scala')
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 3144d8140d..17a8b3ce37 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -58,13 +58,15 @@ trait DocComments { self: SymbolTable =>
* of the same string are done, which is
* interpreted as a recursive variable definition.
*/
- def expandedDocComment(sym: Symbol, site: Symbol): String =
- expandVariables(cookedDocComment(sym), sym, site)
+ def expandedDocComment(sym: Symbol, site: Symbol): String = {
+ val site1 = if (sym.isClass && (site hasFlag Flags.PACKAGE)) sym else site // when parsing a top level class, use the class itself to look up variable definitions
+ expandVariables(cookedDocComment(sym), sym, site1)
+ }
/** The cooked doc comment of symbol `sym` after variable expansion, or "" if missing.
* @param sym The symbol for which doc comment is returned (site is always the containing class)
*/
- def expandedDocComment(sym: Symbol): String = expandedDocComment(sym, sym)
+ def expandedDocComment(sym: Symbol): String = expandedDocComment(sym, sym.enclClass)
/** The list of use cases of doc comment of symbol `sym` seen as a member of class
* `site`. Each use case consists of a synthetic symbol (which is entered nowhere else),