diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala index 856f85d9e3..2af2037fec 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/AsmUtils.scala @@ -8,6 +8,7 @@ package scala.tools.nsc.backend.jvm import scala.tools.asm.tree.{ClassNode, MethodNode} import java.io.PrintWriter import scala.tools.asm.util.{TraceClassVisitor, TraceMethodVisitor, Textifier} +import scala.tools.asm.ClassReader object AsmUtils { @@ -50,4 +51,11 @@ object AsmUtils { w.flush() } + def traceClass(bytes: Array[Byte]): Unit = traceClass(readClass(bytes)) + + def readClass(bytes: Array[Byte]): ClassNode = { + val node = new ClassNode() + new ClassReader(bytes).accept(node, 0) + node + } } |