@@ -758,7 +758,7 @@ trait Printers
758
758
printType(tree.tpe)
759
759
760
760
case Term .Select (qual, name) =>
761
- printTree (qual)
761
+ printQualTree (qual)
762
762
if (name != " <init>" && name != " package" )
763
763
this += " ." += name
764
764
this
@@ -809,7 +809,7 @@ trait Printers
809
809
case Term .Apply (fn, args) =>
810
810
fn match {
811
811
case Term .Select (Term .This (_), " <init>" ) => this += " this" // call to constructor inside a constructor
812
- case _ => printTree (fn)
812
+ case _ => printQualTree (fn)
813
813
}
814
814
val args1 = args match {
815
815
case init :+ Term .Typed (Term .Repeated (Nil , _), _) => init // drop empty var args at the end
@@ -819,7 +819,7 @@ trait Printers
819
819
inParens(printTrees(args1, " , " ))
820
820
821
821
case Term .TypeApply (fn, args) =>
822
- printTree (fn)
822
+ printQualTree (fn)
823
823
fn match {
824
824
case Term .Select (Term .New (TypeTree .Applied (_, _)), " <init>" ) =>
825
825
// type bounds already printed in `fn`
@@ -894,7 +894,7 @@ trait Printers
894
894
printTree(elsep)
895
895
896
896
case Term .Match (selector, cases) =>
897
- printTree (selector)
897
+ printQualTree (selector)
898
898
this += highlightKeyword(" match" , color)
899
899
inBlock(printCases(cases, lineBreak()))
900
900
@@ -941,6 +941,14 @@ trait Printers
941
941
942
942
}
943
943
944
+ def printQualTree (tree : Tree ): Buffer = tree match {
945
+ case Term .IsIf (_) | Term .IsMatch (_) | Term .IsWhile (_) | Term .IsTry (_) | Term .IsReturn (_) =>
946
+ this += " ("
947
+ printTree(tree)
948
+ this += " )"
949
+ case _ => printTree(tree)
950
+ }
951
+
944
952
def flatBlock (stats : List [Statement ], expr : Term ): (List [Statement ], Term ) = {
945
953
val flatStats = List .newBuilder[Statement ]
946
954
def extractFlatStats (stat : Statement ): Unit = stat match {
0 commit comments