summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2010-01-27 11:08:54 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2010-01-27 11:08:54 +0000
commite12005a1077d15a85cf544dc1f0a8cc229201cad (patch)
treeb709d866e256fff060f3853ef08f98f66e850d23
parent96270a3450d1ab25a0ce9695ab8b90a76e04d734 (diff)
downloadscala-e12005a1077d15a85cf544dc1f0a8cc229201cad.tar.gz
scala-e12005a1077d15a85cf544dc1f0a8cc229201cad.tar.bz2
scala-e12005a1077d15a85cf544dc1f0a8cc229201cad.zip
reverting r20688 for now, no review
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala39
-rw-r--r--test/files/pos/t2868/Jann.java5
-rw-r--r--test/files/pos/t2868/Nest.java3
-rw-r--r--test/files/pos/t2868/pick_1.scala7
-rw-r--r--test/files/pos/t2868/test_2.scala6
5 files changed, 19 insertions, 41 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 =
diff --git a/test/files/pos/t2868/Jann.java b/test/files/pos/t2868/Jann.java
deleted file mode 100644
index f5b68de7b0..0000000000
--- a/test/files/pos/t2868/Jann.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public @interface Jann {
- public String str();
- public Nest inn();
- public int[] arr();
-}
diff --git a/test/files/pos/t2868/Nest.java b/test/files/pos/t2868/Nest.java
deleted file mode 100644
index 53652291ad..0000000000
--- a/test/files/pos/t2868/Nest.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public @interface Nest {
- public int value();
-}
diff --git a/test/files/pos/t2868/pick_1.scala b/test/files/pos/t2868/pick_1.scala
deleted file mode 100644
index e91728ec2f..0000000000
--- a/test/files/pos/t2868/pick_1.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-class ann(s: String) extends StaticAnnotation
-class pick {
- final val s = "bang!"
- @ann("bang!") def foo = 1
- @Jann(str = "bang!", inn = new Nest(1), arr = Array(1, 2)) def bar = 2
- @Jann(str = "bang!", inn = new Nest(1), arr = Array(1, 2)) def baz = 3
-}
diff --git a/test/files/pos/t2868/test_2.scala b/test/files/pos/t2868/test_2.scala
deleted file mode 100644
index f11ef0fae2..0000000000
--- a/test/files/pos/t2868/test_2.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-class test {
- val l = (new pick).s
- val u = (new pick).foo
- val c = (new pick).bar
- val k = (new pick).baz
-}