aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Trees.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/core/Trees.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Trees.scala b/src/dotty/tools/dotc/core/Trees.scala
index 3e09eafb7..054b17fa9 100644
--- a/src/dotty/tools/dotc/core/Trees.scala
+++ b/src/dotty/tools/dotc/core/Trees.scala
@@ -8,6 +8,7 @@ import language.higherKinds
import collection.mutable
import collection.mutable.ArrayBuffer
import parsing.Tokens.Token
+import util.Stats
object Trees {
@@ -21,6 +22,9 @@ object Trees {
type TypedTree = Tree[Type]
type UntypedTree = Tree[Untyped]
+ /** The total number of created tree nodes, maintained if Stats.enabled */
+ var ntrees = 0
+
/** A base class for things that have positions (currently: modifiers and trees)
*/
abstract class Positioned extends DotClass with Product {
@@ -133,6 +137,8 @@ object Trees {
*/
abstract class Tree[T >: Untyped] extends Positioned with Product with Showable with Cloneable {
+ if (Stats.enabled) ntrees += 1
+
/** The type constructor at the root of the tree */
type ThisTree[T >: Untyped] <: Tree[T]