@@ -381,28 +381,26 @@ abstract class UnPickler {
381
381
/** Read an annotation argument, which is pickled either
382
382
* as a Constant or a Tree.
383
383
*/
384
- private def readAnnotArg (i : Int ): Tree = {
384
+ private def readAnnotArg (): Tree = {
385
385
if (peekByte() == TREE ) {
386
- at(i, readTree)
386
+ readTree( )
387
387
} else {
388
- val const = at(i, readConstant)
388
+ val const = readConstant( )
389
389
Literal (const).setType(const.tpe)
390
390
}
391
391
}
392
392
393
393
/** Read a ClassfileAnnotArg (argument to a classfile annotation)
394
394
*/
395
- private def readClassfileAnnotArg (i : Int ): ClassfileAnnotArg = bytes(index(i)) match {
396
- case ANNOTINFO =>
397
- NestedAnnotArg (at(i, readAnnotation))
398
- case ANNOTARGARRAY =>
399
- at(i, () => {
400
- readByte() // skip the `annotargarray` tag
401
- val end = readNat() + readIndex
402
- ArrayAnnotArg (until(end, () => readClassfileAnnotArg(readNat())).toArray)
403
- })
404
- case _ =>
405
- LiteralAnnotArg (at(i, readConstant))
395
+ private def readClassfileAnnotArg (): ClassfileAnnotArg = peekByte() match {
396
+ case ANNOTINFO =>
397
+ NestedAnnotArg (readAnnotation())
398
+ case ANNOTARGARRAY =>
399
+ readByte()
400
+ val end = readNat() + readIndex
401
+ ArrayAnnotArg (until(end, readClassfileAnnotArgRef).toArray)
402
+ case _ =>
403
+ LiteralAnnotArg (readConstant())
406
404
}
407
405
408
406
/** Read an AnnotationInfo. Not to be called directly, use
@@ -414,13 +412,10 @@ abstract class UnPickler {
414
412
val assocs = new ListBuffer [(Name , ClassfileAnnotArg )]
415
413
while (readIndex != end) {
416
414
val argref = readNat()
417
- if (isNameEntry(argref)) {
418
- val name = at(argref, readName)
419
- val arg = readClassfileAnnotArg(readNat())
420
- assocs += ((name, arg))
421
- }
415
+ if (isNameEntry(argref))
416
+ assocs += ((at(argref, readName), readClassfileAnnotArgRef))
422
417
else
423
- args += readAnnotArg (argref)
418
+ args += at (argref, readAnnotArg )
424
419
}
425
420
AnnotationInfo (atp, args.toList, assocs.toList)
426
421
}
@@ -731,6 +726,10 @@ abstract class UnPickler {
731
726
private def readSymbolRef (): Symbol = at(readNat(), readSymbol)
732
727
private def readTypeRef (): Type = at(readNat(), readType)
733
728
private def readConstantRef (): Constant = at(readNat(), readConstant)
729
+ private def readAnnotArgRef (): Tree =
730
+ at(readNat(), readAnnotArg)
731
+ private def readClassfileAnnotArgRef (): ClassfileAnnotArg =
732
+ at(readNat(), readClassfileAnnotArg)
734
733
private def readAnnotationRef (): AnnotationInfo =
735
734
at(readNat(), readAnnotation)
736
735
private def readModifiersRef (): Modifiers =
0 commit comments