diff options
author | Martin Odersky <odersky@gmail.com> | 2010-04-09 17:29:00 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-04-09 17:29:00 +0000 |
commit | 33aa7965dd6ed52d2194664932a292c8061915ee (patch) | |
tree | 1f658eaf23b94ce2e037fc79473d4137f30dfd88 /src | |
parent | 8fc50d2aa738670f6018ec58fd26979631b772f6 (diff) | |
download | scala-33aa7965dd6ed52d2194664932a292c8061915ee.tar.gz scala-33aa7965dd6ed52d2194664932a292c8061915ee.tar.bz2 scala-33aa7965dd6ed52d2194664932a292c8061915ee.zip |
fixed one more issue that prevented variables i...
fixed one more issue that prevented variables in companion objects to be
expanded.
Diffstat (limited to 'src')
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/DocComments.scala | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 17a8b3ce37..febb4b221d 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -59,7 +59,9 @@ trait DocComments { self: SymbolTable => * interpreted as a recursive variable definition. */ 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 + // when parsing a top level class or module, use the (module-)class itself to look up variable definitions + val site1 = if ((sym.isModule || sym.isClass) && (site hasFlag Flags.PACKAGE)) sym + else site expandVariables(cookedDocComment(sym), sym, site1) } @@ -205,11 +207,18 @@ trait DocComments { self: SymbolTable => def lookupVariable(vble: String, site: Symbol): Option[String] = if (site == NoSymbol) None - else - mapFind(site.info.baseClasses)(defs(_).get(vble)) match { + else { + def lookInBaseClasses = mapFind(site.info.baseClasses)(defs(_).get(vble)) match { case None => lookupVariable(vble, site.owner) case someStr => someStr } + if (site.isModule) + defs(site).get(vble) match { + case Some(str) => return Some(str) + case None => lookInBaseClasses + } + else lookInBaseClasses + } private var expandCount = 0 private final val expandLimit = 10 |