Skip to content

Commit 1f6f4fd

Browse files
committed
Move TreeShowDeco into TreeOps
1 parent 580415e commit 1f6f4fd

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

library/src/scala/tasty/Reflection.scala

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,25 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
482482

483483
// ----- Tree -----------------------------------------------------
484484

485-
extension TreeOps on (self: Tree) {
485+
/** Members of Tree */
486+
extension TreeOps on (tree: Tree) {
486487
/** Position in the source code */
487-
def pos(given ctx: Context): Position = internal.Tree_pos(self)
488+
def pos(given ctx: Context): Position = internal.Tree_pos(tree)
488489

489-
def symbol(given ctx: Context): Symbol = internal.Tree_symbol(self)
490+
/** Symbol of defined or refered by this tree */
491+
def symbol(given ctx: Context): Symbol = internal.Tree_symbol(tree)
492+
493+
/** Shows the tree as extractors */
494+
def showExtractors(given ctx: Context): String =
495+
new ExtractorsPrinter[self.type](self).showTree(tree)
496+
497+
/** Shows the tree as fully typed source code */
498+
def show(given ctx: Context): String =
499+
tree.showWith(SyntaxHighlight.plain)
500+
501+
/** Shows the tree as fully typed source code */
502+
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
503+
new SourceCodePrinter[self.type](self)(syntaxHighlight).showTree(tree)
490504
}
491505

492506
given (given Context): IsInstanceOf[PackageClause] = internal.isInstanceOfPackageClause
@@ -2655,22 +2669,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
26552669
// PRINTERS //
26562670
//////////////
26572671

2658-
/** Adds `show` as an extension method of a `Tree` */
2659-
extension TreeShowDeco on (tree: Tree) {
2660-
/** Shows the tree as extractors */
2661-
def showExtractors(given ctx: Context): String =
2662-
new ExtractorsPrinter[self.type](self).showTree(tree)
2663-
2664-
/** Shows the tree as fully typed source code */
2665-
def show(given ctx: Context): String =
2666-
tree.showWith(SyntaxHighlight.plain)
2667-
2668-
/** Shows the tree as fully typed source code */
2669-
def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String =
2670-
new SourceCodePrinter[self.type](self)(syntaxHighlight).showTree(tree)
2671-
2672-
}
2673-
26742672
/** Adds `show` as an extension method of a `TypeOrBounds` */
26752673
extension TypeOrBoundsShowDeco on (tpe: TypeOrBounds) {
26762674
/** Shows the tree as extractors */

0 commit comments

Comments
 (0)