@@ -57,12 +57,13 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
57
57
58
58
case cdef@ ClassDef (name, DefDef (_, targs, argss, _, _), parents, self, stats) =>
59
59
val flags = cdef.flags
60
+ if (flags.isFinal && ! flags.isObject) this += " final "
60
61
if (flags.isCase) this += " case "
61
62
62
- if (cdef. flags.isObject) this += " object " += name.stripSuffix(" $" )
63
+ if (flags.isObject) this += " object " += name.stripSuffix(" $" )
63
64
else this += " class " += name
64
65
65
- if (! cdef. flags.isObject) {
66
+ if (! flags.isObject) {
66
67
printTargsDefs(targs)
67
68
val it = argss.iterator
68
69
while (it.hasNext)
@@ -200,7 +201,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
200
201
this += " ]"
201
202
202
203
case Term .Super (qual, tptOpt) =>
203
- ???
204
+ printTree(qual)
205
+ this += " .super"
206
+ // TODO use tptOpt?
204
207
205
208
case Term .Typed (term, tpt) =>
206
209
this += " ("
@@ -531,7 +534,11 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
531
534
printType(tree.tpe)
532
535
533
536
case TypeTree .TypeSelect (qual, name) =>
534
- printTree(qual) += " ." += name
537
+ (qual : Any ) match {
538
+ case qual @ TypeTree .TypeIdent (_) => printTypeTree(qual) // FIXME: qual is of type Tree buy we are getting a TypeTree qualifier
539
+ case _ => printTree(qual)
540
+ }
541
+ this += " ." += name
535
542
536
543
case TypeTree .Singleton (ref) =>
537
544
printTree(ref)
@@ -586,7 +593,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
586
593
587
594
case Type .SymRef (sym, prefix) =>
588
595
prefix match {
589
- case Type .ThisType (Type .SymRef (PackageDef (pack, _), NoPrefix ())) if pack == " <root>" || pack == " <empty>" =>
596
+ case EmptyPackage () =>
597
+ case RootPackage () =>
590
598
case prefix@ Type .SymRef (ClassDef (_, _, _, _, _), _) =>
591
599
printType(prefix)
592
600
this += " #"
@@ -610,10 +618,10 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
610
618
611
619
case Type .TypeRef (name, prefix) =>
612
620
prefix match {
621
+ case NoPrefix () =>
613
622
case prefix@ Type () =>
614
623
printType(prefix)
615
624
this += " ."
616
- case NoPrefix () =>
617
625
}
618
626
this += name.stripSuffix(" $" )
619
627
@@ -714,4 +722,24 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
714
722
case _ => false
715
723
}
716
724
}
725
+
726
+ private object RootPackage {
727
+ def unapply (tpe : TypeOrBounds )(implicit ctx : Context ): Boolean = tpe match {
728
+ case Type .ThisType (Type .SymRef (PackageDef (" <root>" , _), NoPrefix ())) => true
729
+ case _ => false
730
+ }
731
+ }
732
+
733
+ private object EmptyPackage {
734
+ def unapply (tpe : TypeOrBounds )(implicit ctx : Context ): Boolean = tpe match {
735
+ case Type .ThisType (Type .SymRef (PackageDef (" <empty>" , _), prefix)) =>
736
+ prefix match {
737
+ case NoPrefix () => true
738
+ case RootPackage () => true
739
+ case _ => false
740
+ }
741
+ case _ => false
742
+ }
743
+ }
744
+
717
745
}
0 commit comments