aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-18 17:41:14 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-05-08 21:48:08 +0200
commit861f10b72e2a6332f8919f6880604bdc49cc3bca (patch)
treebe61131941ee21ebd03fbb7b49819e32dfd5131f /src/dotty/tools/dotc/ast/Trees.scala
parenta8894ed954e16b481379f09ce7e04342bd9b34f2 (diff)
downloaddotty-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/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala10
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]