diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/util/ShowPickled.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/ShowPickled.scala | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index 2b87280c24..f9d706ae55 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -3,17 +3,17 @@ * @author Martin Odersky */ -package scala.tools +package scala +package tools package nsc package util -import java.io.{File, FileInputStream, PrintStream} +import java.io.PrintStream import java.lang.Long.toHexString import java.lang.Float.intBitsToFloat import java.lang.Double.longBitsToDouble import scala.reflect.internal.{Flags, Names} import scala.reflect.internal.pickling.{ PickleBuffer, PickleFormat } -import interpreter.ByteCode.scalaSigBytesForPath object ShowPickled extends Names { import PickleFormat._ @@ -94,7 +94,6 @@ object ShowPickled extends Names { case ANNOTATEDtpe => "ANNOTATEDtpe" case ANNOTINFO => "ANNOTINFO" case ANNOTARGARRAY => "ANNOTARGARRAY" - // case DEBRUIJNINDEXtpe => "DEBRUIJNINDEXtpe" case EXISTENTIALtpe => "EXISTENTIALtpe" case TREE => "TREE" case MODIFIERS => "MODIFIERS" @@ -165,7 +164,7 @@ object ShowPickled extends Names { out.print(" %s[%s]".format(toHexString(pflags), flagString)) } - /** Might be info or privateWithin */ + /* Might be info or privateWithin */ val x = buf.readNat() if (buf.readIndex == end) { printFlags(None) @@ -177,9 +176,9 @@ object ShowPickled extends Names { } } - /** Note: the entries which require some semantic analysis to be correctly - * interpreted are for the most part going to tell you the wrong thing. - * It's not so easy to duplicate the logic applied in the UnPickler. + /* Note: the entries which require some semantic analysis to be correctly + * interpreted are for the most part going to tell you the wrong thing. + * It's not so easy to duplicate the logic applied in the UnPickler. */ def printEntry(i: Int) { buf.readIndex = index(i) @@ -251,7 +250,7 @@ object ShowPickled extends Names { case SYMANNOT => printSymbolRef(); printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTATEDtpe => - printTypeRef(); buf.until(end, printAnnotInfoRef); + printTypeRef(); buf.until(end, printAnnotInfoRef) case ANNOTINFO => printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTARGARRAY => @@ -272,8 +271,7 @@ object ShowPickled extends Names { for (i <- 0 until index.length) printEntry(i) } - def fromFile(path: String) = fromBytes(io.File(path).toByteArray) - def fromName(name: String) = fromBytes(scalaSigBytesForPath(name) getOrElse Array()) + def fromFile(path: String) = fromBytes(io.File(path).toByteArray()) def fromBytes(data: => Array[Byte]): Option[PickleBuffer] = try Some(new PickleBuffer(data, 0, data.length)) catch { case _: Exception => None } @@ -288,7 +286,7 @@ object ShowPickled extends Names { def main(args: Array[String]) { args foreach { arg => - (fromFile(arg) orElse fromName(arg)) match { + fromFile(arg) match { case Some(pb) => show(arg + ":", pb) case _ => Console.println("Cannot read " + arg) } |