File tree Expand file tree Collapse file tree 4 files changed +10
-453
lines changed
src/dotty/tools/scaladoc/tasty Expand file tree Collapse file tree 4 files changed +10
-453
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ trait BasicSupport:
3737 Annotation (dri, params)
3838
3939 extension (using Quotes )(sym : reflect.Symbol )
40- def documentation = sym.docstring.map(parseComment(_ , sym.tree) )
40+ def documentation = parseComment( sym.docstring.getOrElse( " " ) , sym.tree)
4141
4242 def getAnnotations (): List [Annotation ] =
4343 sym.annotations.filterNot(_.symbol.packageName.startsWith(" scala.annotation.internal" )).map(parseAnnotation).reverse
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ object ScaladocSupport:
2929
3030 defaultSyntax
3131 }
32- case None =>
32+ case None =>
3333 pathBasedCommentSyntax()
3434 }
3535
@@ -41,17 +41,20 @@ object ScaladocSupport:
4141 }
4242 parser.parse(preparsed)
4343
44- def parseComment (using Quotes , DocContext )(docstring : String , tree : reflect.Tree ): Comment =
44+ def parseComment (using Quotes , DocContext )(docstring : String , tree : reflect.Tree ): Option [ Comment ] =
4545 val commentString : String =
4646 if tree.symbol.isClassDef || tree.symbol.owner.isClassDef then
4747 import dotty .tools .dotc
48+ import dotty .tools .dotc .core .Comments .CommentsContext
4849 given ctx : dotc.core.Contexts .Context = quotes.asInstanceOf [scala.quoted.runtime.impl.QuotesImpl ].ctx
4950
51+ val docCtx = ctx.docCtx.get
52+
5053 val sym = tree.symbol.asInstanceOf [dotc.core.Symbols .Symbol ]
5154
52- comments.CommentExpander .cookComment(sym)(using ctx)
53- .get.expanded.get
55+ docCtx.templateExpander.expand(sym, sym.owner)
5456 else
5557 docstring
56-
57- parseCommentString(commentString, tree.symbol, Some (tree.pos))
58+ if commentString == " "
59+ then None
60+ else Some (parseCommentString(commentString, tree.symbol, Some (tree.pos)))
You can’t perform that action at this time.
0 commit comments