aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-04-07 08:27:43 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-04-07 08:57:05 +0200
commitf43f520a1a6e60d4a6020af97c52dd6c43ea75cd (patch)
tree2d746b4de308c1fc580e00704254b0b843ede5c4 /src/dotty/tools/dotc/typer/Namer.scala
parent844683edb78f45bf37949bd923f56fc98a68c837 (diff)
downloaddotty-f43f520a1a6e60d4a6020af97c52dd6c43ea75cd.tar.gz
dotty-f43f520a1a6e60d4a6020af97c52dd6c43ea75cd.tar.bz2
dotty-f43f520a1a6e60d4a6020af97c52dd6c43ea75cd.zip
Add binding between Symbol and Untyped tree in base context
This commit also adds a printer for use by dottydoc.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index de27333d5..82b3b56e9 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -401,19 +401,29 @@ class Namer { typer: Typer =>
val pkg = createPackageSymbol(pcl.pid)
index(pcl.stats)(ctx.fresh.setOwner(pkg.moduleClass))
invalidateCompanions(pkg, Trees.flatten(pcl.stats map expanded))
+ setDocstring(pkg, stat)
ctx
case imp: Import =>
importContext(createSymbol(imp), imp.selectors)
case mdef: DefTree =>
- enterSymbol(createSymbol(mdef))
+ val sym = enterSymbol(createSymbol(mdef))
+ setDocstring(sym, stat)
ctx
case stats: Thicket =>
- for (tree <- stats.toList) enterSymbol(createSymbol(tree))
+ for (tree <- stats.toList) {
+ val sym = enterSymbol(createSymbol(tree))
+ setDocstring(sym, stat)
+ }
ctx
case _ =>
ctx
}
+ def setDocstring(sym: Symbol, tree: Tree)(implicit ctx: Context) = tree match {
+ case t: MemberDef => ctx.base.addDocstring(sym, t.rawComment)
+ case _ => ()
+ }
+
/** Create top-level symbols for statements and enter them into symbol table */
def index(stats: List[Tree])(implicit ctx: Context): Context = {
@@ -859,7 +869,7 @@ class Namer { typer: Typer =>
WildcardType
}
paramFn(typedAheadType(mdef.tpt, tptProto).tpe)
- }
+ }
/** The type signature of a DefDef with given symbol */
def defDefSig(ddef: DefDef, sym: Symbol)(implicit ctx: Context) = {