File tree 4 files changed +10
-453
lines changed
src/dotty/tools/scaladoc/tasty 4 files changed +10
-453
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ trait BasicSupport:
37
37
Annotation (dri, params)
38
38
39
39
extension (using Quotes )(sym : reflect.Symbol )
40
- def documentation = sym.docstring.map(parseComment(_ , sym.tree) )
40
+ def documentation = parseComment( sym.docstring.getOrElse( " " ) , sym.tree)
41
41
42
42
def getAnnotations (): List [Annotation ] =
43
43
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:
29
29
30
30
defaultSyntax
31
31
}
32
- case None =>
32
+ case None =>
33
33
pathBasedCommentSyntax()
34
34
}
35
35
@@ -41,17 +41,20 @@ object ScaladocSupport:
41
41
}
42
42
parser.parse(preparsed)
43
43
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 ] =
45
45
val commentString : String =
46
46
if tree.symbol.isClassDef || tree.symbol.owner.isClassDef then
47
47
import dotty .tools .dotc
48
+ import dotty .tools .dotc .core .Comments .CommentsContext
48
49
given ctx : dotc.core.Contexts .Context = quotes.asInstanceOf [scala.quoted.runtime.impl.QuotesImpl ].ctx
49
50
51
+ val docCtx = ctx.docCtx.get
52
+
50
53
val sym = tree.symbol.asInstanceOf [dotc.core.Symbols .Symbol ]
51
54
52
- comments.CommentExpander .cookComment(sym)(using ctx)
53
- .get.expanded.get
55
+ docCtx.templateExpander.expand(sym, sym.owner)
54
56
else
55
57
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