aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/tasty/TreePickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-13 11:14:51 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-15 19:33:51 +0200
commitbc0bdb198269f040bd0b7fc0abeb30447fd2abe1 (patch)
treead41710527246bc24aa7da2a0d465cbdc05c0dfc /src/dotty/tools/dotc/core/tasty/TreePickler.scala
parent8b55988c64ab7d777b6bf39987af6bafe070c2fb (diff)
downloaddotty-bc0bdb198269f040bd0b7fc0abeb30447fd2abe1.tar.gz
dotty-bc0bdb198269f040bd0b7fc0abeb30447fd2abe1.tar.bz2
dotty-bc0bdb198269f040bd0b7fc0abeb30447fd2abe1.zip
Record position of self type
Also, some simplifying refactorings and renamings
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty/TreePickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreePickler.scala18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index 99a83a57c..18920ec30 100644
--- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -153,6 +153,11 @@ class TreePickler(pickler: TastyPickler) {
throw ex
}
+ def pickleTypeWithPos(tpe: Type, tree: Tree)(implicit ctx: Context): Unit = {
+ registerTreeAddr(tree)
+ pickleType(tpe)
+ }
+
private def pickleNewType(tpe: Type, richTypes: Boolean)(implicit ctx: Context): Unit = try { tpe match {
case AppliedType(tycon, args) =>
writeByte(APPLIEDtype)
@@ -300,10 +305,8 @@ class TreePickler(pickler: TastyPickler) {
pickled
}
- def pickleTpt(tpt: Tree)(implicit ctx: Context): Unit = {
- pickledTrees.put(tpt, currentAddr)
- pickleType(tpt.tpe) // TODO correlate with original when generating positions
- }
+ def pickleTpt(tpt: Tree)(implicit ctx: Context): Unit =
+ pickleTypeWithPos(tpt.tpe, tpt) // TODO correlate with original when generating positions
def pickleTreeUnlessEmpty(tree: Tree)(implicit ctx: Context): Unit =
if (!tree.isEmpty) pickleTree(tree)
@@ -325,7 +328,7 @@ class TreePickler(pickler: TastyPickler) {
}
def pickleParam(tree: Tree)(implicit ctx: Context): Unit = {
- pickledTrees.put(tree, currentAddr)
+ registerTreeAddr(tree)
tree match {
case tree: ValDef => pickleDef(PARAM, tree.symbol, tree.tpt)
case tree: DefDef => pickleDef(PARAM, tree.symbol, tree.tpt, tree.rhs)
@@ -344,7 +347,7 @@ class TreePickler(pickler: TastyPickler) {
}
def pickleTree(tree: Tree)(implicit ctx: Context): Unit = try {
- pickledTrees.put(tree, currentAddr)
+ registerTreeAddr(tree)
tree match {
case Ident(name) =>
tree.tpe match {
@@ -493,6 +496,7 @@ class TreePickler(pickler: TastyPickler) {
if ((selfInfo ne NoType) || !tree.self.isEmpty) {
writeByte(SELFDEF)
pickleName(tree.self.name)
+ registerTreeAddr(tree.self)
pickleType {
cinfo.selfInfo match {
case sym: Symbol => sym.info
@@ -525,7 +529,7 @@ class TreePickler(pickler: TastyPickler) {
}
def pickleSelector(tag: Int, id: untpd.Ident)(implicit ctx: Context): Unit = {
- pickledTrees.put(id, currentAddr)
+ registerTreeAddr(id)
writeByte(tag)
pickleName(id.name)
}