diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-01-27 11:08:54 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-01-27 11:08:54 +0000 |
commit | e12005a1077d15a85cf544dc1f0a8cc229201cad (patch) | |
tree | b709d866e256fff060f3853ef08f98f66e850d23 /src/compiler | |
parent | 96270a3450d1ab25a0ce9695ab8b90a76e04d734 (diff) | |
download | scala-e12005a1077d15a85cf544dc1f0a8cc229201cad.tar.gz scala-e12005a1077d15a85cf544dc1f0a8cc229201cad.tar.bz2 scala-e12005a1077d15a85cf544dc1f0a8cc229201cad.zip |
reverting r20688 for now, no review
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index b5cb171ed1..8258878376 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -381,28 +381,26 @@ abstract class UnPickler { /** Read an annotation argument, which is pickled either * as a Constant or a Tree. */ - private def readAnnotArg(i: Int): Tree = { + private def readAnnotArg(): Tree = { if (peekByte() == TREE) { - at(i, readTree) + readTree() } else { - val const = at(i, readConstant) + val const = readConstant() Literal(const).setType(const.tpe) } } /** Read a ClassfileAnnotArg (argument to a classfile annotation) */ - private def readClassfileAnnotArg(i: Int): ClassfileAnnotArg = bytes(index(i)) match { - case ANNOTINFO => - NestedAnnotArg(at(i, readAnnotation)) - case ANNOTARGARRAY => - at(i, () => { - readByte() // skip the `annotargarray` tag - val end = readNat() + readIndex - ArrayAnnotArg(until(end, () => readClassfileAnnotArg(readNat())).toArray) - }) - case _ => - LiteralAnnotArg(at(i, readConstant)) + private def readClassfileAnnotArg(): ClassfileAnnotArg = peekByte() match { + case ANNOTINFO => + NestedAnnotArg(readAnnotation()) + case ANNOTARGARRAY => + readByte() + val end = readNat() + readIndex + ArrayAnnotArg(until(end, readClassfileAnnotArgRef).toArray) + case _ => + LiteralAnnotArg(readConstant()) } /** Read an AnnotationInfo. Not to be called directly, use @@ -414,13 +412,10 @@ abstract class UnPickler { val assocs = new ListBuffer[(Name, ClassfileAnnotArg)] while (readIndex != end) { val argref = readNat() - if (isNameEntry(argref)) { - val name = at(argref, readName) - val arg = readClassfileAnnotArg(readNat()) - assocs += ((name, arg)) - } + if (isNameEntry(argref)) + assocs += ((at(argref, readName), readClassfileAnnotArgRef)) else - args += readAnnotArg(argref) + args += at(argref, readAnnotArg) } AnnotationInfo(atp, args.toList, assocs.toList) } @@ -731,6 +726,10 @@ abstract class UnPickler { private def readSymbolRef(): Symbol = at(readNat(), readSymbol) private def readTypeRef(): Type = at(readNat(), readType) private def readConstantRef(): Constant = at(readNat(), readConstant) + private def readAnnotArgRef(): Tree = + at(readNat(), readAnnotArg) + private def readClassfileAnnotArgRef(): ClassfileAnnotArg = + at(readNat(), readClassfileAnnotArg) private def readAnnotationRef(): AnnotationInfo = at(readNat(), readAnnotation) private def readModifiersRef(): Modifiers = |