diff options
author | Martin Odersky <odersky@gmail.com> | 2014-04-18 17:41:14 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-05-08 21:48:08 +0200 |
commit | 861f10b72e2a6332f8919f6880604bdc49cc3bca (patch) | |
tree | be61131941ee21ebd03fbb7b49819e32dfd5131f /src | |
parent | a8894ed954e16b481379f09ce7e04342bd9b34f2 (diff) | |
download | dotty-861f10b72e2a6332f8919f6880604bdc49cc3bca.tar.gz dotty-861f10b72e2a6332f8919f6880604bdc49cc3bca.tar.bz2 dotty-861f10b72e2a6332f8919f6880604bdc49cc3bca.zip |
Added a unique identifier to trees.
Used for debugging purposes for now. Might be used for replaying IDE interactions later.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/ast/Trees.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index 2ae494d55..8df486968 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -180,6 +180,8 @@ object Trees { def tokenPos: Seq[(Token, Position)] = ??? } + private var nextId = 0 + /** Trees take a parameter indicating what the type of their `tpe` field * is. Two choices: `Type` or `Untyped`. * Untyped trees have type `Tree[Untyped]`. @@ -204,6 +206,14 @@ object Trees { if (Stats.enabled) ntrees += 1 + /** A unique identifier for this tree. Used for debugging, and potentially + * tracking presentation compiler interactions + */ + val uniqueId = { + nextId += 1 + nextId + } + /** The type constructor at the root of the tree */ type ThisTree[T >: Untyped] <: Tree[T] |