summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala41
1 files changed, 21 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 8258878376..bd1a13187d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -381,26 +381,28 @@ abstract class UnPickler {
/** Read an annotation argument, which is pickled either
* as a Constant or a Tree.
*/
- private def readAnnotArg(): Tree = {
- if (peekByte() == TREE) {
- readTree()
+ private def readAnnotArg(i: Int): Tree = {
+ if (bytes(index(i)) == TREE) {
+ at(i, readTree)
} else {
- val const = readConstant()
+ val const = at(i, readConstant)
Literal(const).setType(const.tpe)
}
}
/** Read a ClassfileAnnotArg (argument to a classfile annotation)
*/
- 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())
+ 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))
}
/** Read an AnnotationInfo. Not to be called directly, use
@@ -412,10 +414,13 @@ abstract class UnPickler {
val assocs = new ListBuffer[(Name, ClassfileAnnotArg)]
while (readIndex != end) {
val argref = readNat()
- if (isNameEntry(argref))
- assocs += ((at(argref, readName), readClassfileAnnotArgRef))
+ if (isNameEntry(argref)) {
+ val name = at(argref, readName)
+ val arg = readClassfileAnnotArg(readNat())
+ assocs += ((name, arg))
+ }
else
- args += at(argref, readAnnotArg)
+ args += readAnnotArg(argref)
}
AnnotationInfo(atp, args.toList, assocs.toList)
}
@@ -726,10 +731,6 @@ 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 =