aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/UnPickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-19 16:22:04 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-19 16:22:04 +0100
commitb72ee12e9eeffe32ffd752c5aaf9ef1713d77286 (patch)
tree0a6bf27e6251ad4d2f62ca91a470ef57a4faafa0 /src/dotty/tools/dotc/core/pickling/UnPickler.scala
parentc1ece3bd0bd67e69c13f5529b02061aaa8330b9a (diff)
downloaddotty-b72ee12e9eeffe32ffd752c5aaf9ef1713d77286.tar.gz
dotty-b72ee12e9eeffe32ffd752c5aaf9ef1713d77286.tar.bz2
dotty-b72ee12e9eeffe32ffd752c5aaf9ef1713d77286.zip
Making TypedTrees a full alternative to Trees
TypedTrees now has the full functionality of Trees. The idea is that a client should inherit from either Trees or TypedTrees, and the rest follows automatically.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/UnPickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index ebc45dffe..7a06b098e 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -9,7 +9,7 @@ import java.lang.Double.longBitsToDouble
import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._
import StdNames._, Denotations._, NameOps._, Flags._, Constants._, Annotations._
-import Trees._, Positions._, TypedTrees._
+import Positions._, TypedTrees._
import io.AbstractFile
import scala.reflect.internal.pickling.PickleFormat._
import scala.collection.{ mutable, immutable }
@@ -620,36 +620,36 @@ class UnPickler(bytes: Array[Byte], classRoot: LazyClassDenotation, moduleRoot:
protected def readAnnotationRef(): Annotation = at(readNat(), readAnnotation)
// protected def readModifiersRef(): Modifiers = at(readNat(), readModifiers)
- protected def readTreeRef(): TypedTree = at(readNat(), readTree)
+ protected def readTreeRef(): Tree = at(readNat(), readTree)
- protected def readTree(): TypedTree = ???
+ protected def readTree(): Tree = ???
/** Read an annotation argument, which is pickled either
* as a Constant or a Tree.
*/
- protected def readAnnotArg(i: Int): TypedTree = bytes(index(i)) match {
+ protected def readAnnotArg(i: Int): Tree = bytes(index(i)) match {
case TREE => at(i, readTree)
- case _ => tpd.Literal(at(i, readConstant))
+ case _ => Literal(at(i, readConstant))
}
/** Read a ClassfileAnnotArg (argument to a classfile annotation)
*/
- private def readArrayAnnotArg(): TypedTree = {
+ private def readArrayAnnotArg(): Tree = {
readByte() // skip the `annotargarray` tag
val end = readNat() + readIndex
// array elements are trees representing instances of scala.annotation.Annotation
- tpd.ArrayValue(
- tpd.TypeTree(defn.AnnotationClass.typeConstructor),
+ ArrayValue(
+ TypeTree(defn.AnnotationClass.typeConstructor),
until(end, () => readClassfileAnnotArg(readNat())))
}
- private def readAnnotInfoArg(): TypedTree = {
+ private def readAnnotInfoArg(): Tree = {
readByte() // skip the `annotinfo` tag
val end = readNat() + readIndex
readAnnotationContents(end)
}
- protected def readClassfileAnnotArg(i: Int): TypedTree = bytes(index(i)) match {
+ protected def readClassfileAnnotArg(i: Int): Tree = bytes(index(i)) match {
case ANNOTINFO => at(i, readAnnotInfoArg)
case ANNOTARGARRAY => at(i, readArrayAnnotArg)
case _ => readAnnotArg(i)
@@ -658,20 +658,20 @@ class UnPickler(bytes: Array[Byte], classRoot: LazyClassDenotation, moduleRoot:
/** Read an annotation's contents. Not to be called directly, use
* readAnnotation, readSymbolAnnotation, or readAnnotInfoArg
*/
- protected def readAnnotationContents(end: Int): TypedTree = {
+ protected def readAnnotationContents(end: Int): Tree = {
val atp = readTypeRef()
- val args = new ListBuffer[TypedTree]
+ val args = new ListBuffer[Tree]
while (readIndex != end) {
val argref = readNat()
args += {
if (isNameEntry(argref)) {
val name = at(argref, readName)
val arg = readClassfileAnnotArg(readNat())
- tpd.NamedArg(name, arg)
+ NamedArg(name, arg)
} else readAnnotArg(argref)
}
}
- tpd.New(atp, args.toList)
+ New(atp, args.toList)
}
/** Read an annotation and as a side effect store it into