aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-08-27 15:41:32 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-06 17:45:14 +0200
commit49b19933dc23220e582016fc0bfd0b35961d61a1 (patch)
tree6835c10369db7e42302cd1889b4807f06ce48911 /src/dotty/tools/dotc/typer/Typer.scala
parent8be7177a5f2f369b4932e54ee888c36544e9d3a5 (diff)
downloaddotty-49b19933dc23220e582016fc0bfd0b35961d61a1.tar.gz
dotty-49b19933dc23220e582016fc0bfd0b35961d61a1.tar.bz2
dotty-49b19933dc23220e582016fc0bfd0b35961d61a1.zip
Move docstring cooking to dotty
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 2a8e7da9a..b24fc6237 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1538,7 +1538,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
tpd.cpy.DefDef(mdef)(rhs = Inliner.bodyToInline(mdef.symbol)) ::
Inliner.removeInlineAccessors(mdef.symbol)
- def typedUsecases(syms: List[Symbol], owner: Symbol)(implicit ctx: Context): Unit = {
+ private def typedUsecases(syms: List[Symbol], owner: Symbol)(implicit ctx: Context): Unit = {
val relevantSyms = syms.filter(ctx.docbase.docstring(_).isDefined)
relevantSyms.foreach { sym =>
expandParentDocs(sym)
@@ -1555,13 +1555,16 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
}
- import dotty.tools.dottydoc.model.comment.CommentExpander
- val expander = new CommentExpander {}
- def expandParentDocs(sym: Symbol)(implicit ctx: Context): Unit =
+ private def expandParentDocs(sym: Symbol)(implicit ctx: Context): Unit =
ctx.docbase.docstring(sym).foreach { cmt =>
- def expandDoc(owner: Symbol): Unit = {
- expander.defineVariables(sym)
- val newCmt = Comment(cmt.pos, expander.expandedDocComment(sym, owner, cmt.raw))
+ def expandDoc(owner: Symbol): Unit = if (!cmt.isExpanded) {
+ val tplExp = ctx.docbase.templateExpander
+ tplExp.defineVariables(sym)
+
+ val newCmt = cmt
+ .expand(tplExp.expandedDocComment(sym, owner, _))
+ .withUsecases
+
ctx.docbase.addDocstring(sym, Some(newCmt))
}