Skip to content

Commit d820034

Browse files
committed
Optimization: Eliminate closures in PositionPickler#traverse
1 parent 218a673 commit d820034

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,18 @@ class PositionPickler(pickler: TastyPickler, addrOfTree: untpd.Tree => Option[Ad
8888
}
8989
}
9090
x match {
91-
case x: untpd.MemberDef @unchecked =>
92-
for (ann <- x.symbol.annotations) traverse(ann.tree, x.source)
91+
case x: untpd.MemberDef @unchecked => traverse(x.symbol.annotations, x.source)
9392
case _ =>
9493
}
95-
traverse(x.productIterator, x.source)
96-
case xs: TraversableOnce[_] =>
97-
xs.foreach(traverse(_, current))
94+
val limit = x.productArity
95+
var n = 0
96+
while (n < limit) {
97+
traverse(x.productElement(n), x.source)
98+
n += 1
99+
}
100+
case y :: ys =>
101+
traverse(y, current)
102+
traverse(ys, current)
98103
case x: Annotation =>
99104
traverse(x.tree, current)
100105
case _ =>

0 commit comments

Comments
 (0)