From c46a200d8cead57030d007ca841e23ccdcd7bd55 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 9 Apr 2010 15:56:35 +0000 Subject: Fixed problem in scaladoc which did not expand ... Fixed problem in scaladoc which did not expand variables in top-level classes. --- src/compiler/scala/tools/nsc/ast/DocComments.scala | 8 +++++--- 1 file 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), -- cgit v1.2.3