Skip to content

Commit d4edd89

Browse files
committed
Print top level packages
1 parent 1a7144a commit d4edd89

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
3434
def printTree(tree: Tree): Buffer = tree match {
3535
case tree @ PackageClause(Term.Ident(name), stats) =>
3636
val stats1 = stats.collect {
37-
case stat@Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat
38-
case stat@Import(_, _) => stat
37+
case stat @ PackageClause(_, _) => stat
38+
case stat @ Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat
39+
case stat @ Import(_, _) => stat
3940
}
4041

4142
if (name == "<empty>") {

tests/run/simpleClass.decompiled

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** Decompiled from out/runTestFromTasty/run/simpleClass/Test.class */
2+
object Test {
3+
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
4+
scala.Predef.println(new foo.A().getClass().getName())
5+
scala.Predef.println(new foo.B().getClass().getName())
6+
}
7+
}/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/A.class */
8+
package foo {
9+
class A()
10+
}
11+
/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/B.class */
12+
package foo {
13+
class B() extends foo.A
14+
}

0 commit comments

Comments
 (0)