Skip to content

Commit e12005a

Browse files
committed
reverting r20688 for now, no review
1 parent 96270a3 commit e12005a

File tree

5 files changed

+19
-41
lines changed

5 files changed

+19
-41
lines changed

src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala

+19-20
Original file line numberDiff line numberDiff line change
@@ -381,28 +381,26 @@ abstract class UnPickler {
381381
/** Read an annotation argument, which is pickled either
382382
* as a Constant or a Tree.
383383
*/
384-
private def readAnnotArg(i: Int): Tree = {
384+
private def readAnnotArg(): Tree = {
385385
if (peekByte() == TREE) {
386-
at(i, readTree)
386+
readTree()
387387
} else {
388-
val const = at(i, readConstant)
388+
val const = readConstant()
389389
Literal(const).setType(const.tpe)
390390
}
391391
}
392392

393393
/** Read a ClassfileAnnotArg (argument to a classfile annotation)
394394
*/
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())
406404
}
407405

408406
/** Read an AnnotationInfo. Not to be called directly, use
@@ -414,13 +412,10 @@ abstract class UnPickler {
414412
val assocs = new ListBuffer[(Name, ClassfileAnnotArg)]
415413
while (readIndex != end) {
416414
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))
422417
else
423-
args += readAnnotArg(argref)
418+
args += at(argref, readAnnotArg)
424419
}
425420
AnnotationInfo(atp, args.toList, assocs.toList)
426421
}
@@ -731,6 +726,10 @@ abstract class UnPickler {
731726
private def readSymbolRef(): Symbol = at(readNat(), readSymbol)
732727
private def readTypeRef(): Type = at(readNat(), readType)
733728
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)
734733
private def readAnnotationRef(): AnnotationInfo =
735734
at(readNat(), readAnnotation)
736735
private def readModifiersRef(): Modifiers =

test/files/pos/t2868/Jann.java

-5
This file was deleted.

test/files/pos/t2868/Nest.java

-3
This file was deleted.

test/files/pos/t2868/pick_1.scala

-7
This file was deleted.

test/files/pos/t2868/test_2.scala

-6
This file was deleted.

0 commit comments

Comments
 (0)