Skip to content

Commit 483a0e6

Browse files
committed
Address review
The method `uniqueId_=` is in the hot path, make the method small so that JVM may optimize it.
1 parent 870fd44 commit 483a0e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Positioned.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Pro
2727
def uniqueId: Int = myUniqueId
2828

2929
def uniqueId_=(id: Int): Unit = {
30-
if (Positioned.debugId == id) {
30+
def printTrace() = {
3131
println(s"Debug tree (id=${Positioned.debugId}) creation \n$this\n")
3232
Reporter.displayPrompt(Console.in, new PrintWriter(Console.err, true))
3333
}
34+
if (Positioned.debugId == id) printTrace()
3435
myUniqueId = id
3536
}
3637

0 commit comments

Comments
 (0)