Skip to content

Commit 0fc0c0c

Browse files
committed
Avoid withFilter in some warm spots
1 parent c5ce6be commit 0fc0c0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import reporting.trace
1010
import dotty.tools.dotc.transform.SymUtils._
1111
import Decorators._
1212
import Constants.Constant
13+
import scala.collection.mutable
1314

1415
import scala.annotation.tailrec
1516

@@ -698,7 +699,10 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
698699

699700
/** The symbols defined locally in a statement list */
700701
def localSyms(stats: List[Tree])(using Context): List[Symbol] =
701-
for (stat <- stats if stat.isDef && stat.symbol.exists) yield stat.symbol
702+
val locals = new mutable.ListBuffer[Symbol]
703+
for stat <- stats do
704+
if stat.isDef && stat.symbol.exists then locals += stat.symbol
705+
locals.toList
702706

703707
/** If `tree` is a DefTree, the symbol defined by it, otherwise NoSymbol */
704708
def definedSym(tree: Tree)(using Context): Symbol =

0 commit comments

Comments
 (0)