@@ -482,11 +482,25 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
482
482
483
483
// ----- Tree -----------------------------------------------------
484
484
485
- extension TreeOps on (self : Tree ) {
485
+ /** Members of Tree */
486
+ extension TreeOps on (tree : Tree ) {
486
487
/** 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 )
488
489
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)
490
504
}
491
505
492
506
given (given Context ): IsInstanceOf [PackageClause ] = internal.isInstanceOfPackageClause
@@ -2655,22 +2669,6 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
2655
2669
// PRINTERS //
2656
2670
// ////////////
2657
2671
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
-
2674
2672
/** Adds `show` as an extension method of a `TypeOrBounds` */
2675
2673
extension TypeOrBoundsShowDeco on (tpe : TypeOrBounds ) {
2676
2674
/** Shows the tree as extractors */
0 commit comments