diff options
Diffstat (limited to 'src/dotty/tools/dotc/core/Scopes.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Scopes.scala | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index 85104f30f..6bcfc6f6a 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -288,11 +288,15 @@ object Scopes { override def foreach[U](p: Symbol => U): Unit = toList foreach p - final def filteredScope(p: Symbol => Boolean)(implicit ctx: Context): MutableScope = { - val unfiltered = toList - val filtered = unfiltered filterConserve p - if (filtered eq unfiltered) this - else newScopeWith(filtered: _*) + override def filter(p: Symbol => Boolean): List[Symbol] = { + var syms: List[Symbol] = Nil + var e = lastEntry + while ((e ne null) && e.owner == this) { + val sym = e.sym + if (p(sym)) syms = sym :: syms + e = e.prev + } + syms } } |