aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-13 09:39:44 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-15 19:33:51 +0200
commit2575d11bd1a670ace8bd7e91777ea135759af51f (patch)
tree57d705b50023fecc44247b6ace8ddf9f7865f336 /src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
parent8bfaadaae141e83db7f515b042fcee26ed0e54fd (diff)
downloaddotty-2575d11bd1a670ace8bd7e91777ea135759af51f.tar.gz
dotty-2575d11bd1a670ace8bd7e91777ea135759af51f.tar.bz2
dotty-2575d11bd1a670ace8bd7e91777ea135759af51f.zip
Preserve all positions in Tasty.
The goal is that pickled and unpickled trees should print the same with -Yprintpos. There are several reasons why this is not the case so far. Some of them are fixed in this commit.
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty/TreeBuffer.scala')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeBuffer.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala b/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
index d741c42c3..f8f7c330f 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeBuffer.scala
@@ -6,7 +6,7 @@ package tasty
import util.Util.{bestFit, dble}
import TastyBuffer.{Addr, AddrWidth}
import config.Printers.pickling
-import ast.tpd.Tree
+import ast.untpd.Tree
class TreeBuffer extends TastyBuffer(50000) {
@@ -19,6 +19,8 @@ class TreeBuffer extends TastyBuffer(50000) {
private[tasty] val pickledTrees = new java.util.IdentityHashMap[Tree, Any] // Value type is really Addr, but that's not compatible with null
+ def registerTreeAddr(tree: Tree) = pickledTrees.put(tree, currentAddr)
+
def addrOfTree(tree: Tree): Option[Addr] = pickledTrees.get(tree) match {
case null => None
case n => Some(n.asInstanceOf[Addr])