From d4edd89b78b20be055a86b520b6037513268681d Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 31 May 2018 17:24:16 +0200 Subject: [PATCH] Print top level packages --- library/src/scala/tasty/util/ShowSourceCode.scala | 5 +++-- tests/run/simpleClass.decompiled | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/run/simpleClass.decompiled diff --git a/library/src/scala/tasty/util/ShowSourceCode.scala b/library/src/scala/tasty/util/ShowSourceCode.scala index 4e8d72b9ba71..66444fa87d7e 100644 --- a/library/src/scala/tasty/util/ShowSourceCode.scala +++ b/library/src/scala/tasty/util/ShowSourceCode.scala @@ -34,8 +34,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty def printTree(tree: Tree): Buffer = tree match { case tree @ PackageClause(Term.Ident(name), stats) => val stats1 = stats.collect { - case stat@Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat - case stat@Import(_, _) => stat + case stat @ PackageClause(_, _) => stat + case stat @ Definition() if !(stat.flags.isObject && stat.flags.isLazy) => stat + case stat @ Import(_, _) => stat } if (name == "") { diff --git a/tests/run/simpleClass.decompiled b/tests/run/simpleClass.decompiled new file mode 100644 index 000000000000..d49784a495a4 --- /dev/null +++ b/tests/run/simpleClass.decompiled @@ -0,0 +1,14 @@ +/** Decompiled from out/runTestFromTasty/run/simpleClass/Test.class */ +object Test { + def main(args: scala.Array[scala.Predef.String]): scala.Unit = { + scala.Predef.println(new foo.A().getClass().getName()) + scala.Predef.println(new foo.B().getClass().getName()) + } +}/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/A.class */ +package foo { + class A() +} +/** Decompiled from out/runTestFromTasty/run/simpleClass/foo/B.class */ +package foo { + class B() extends foo.A +}