aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Decorators.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/Decorators.scala')
-rw-r--r--src/dotty/tools/dotc/core/Decorators.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala
index ba3123358..d0ce3efe0 100644
--- a/src/dotty/tools/dotc/core/Decorators.scala
+++ b/src/dotty/tools/dotc/core/Decorators.scala
@@ -1,6 +1,9 @@
package dotty.tools.dotc
package core
+import annotation.tailrec
+import Symbols._
+
import Contexts._, Names._
object Decorators {
@@ -15,6 +18,16 @@ object Decorators {
context.names.newTermName(s)
}
+ implicit class SymbolIteratorDecorator(val it: Iterator[Symbol]) extends AnyVal {
+ final def findSymbol(p: Symbol => Boolean): Symbol = {
+ while (it.hasNext) {
+ val sym = it.next
+ if (p(sym)) return sym
+ }
+ NoSymbol
+ }
+ }
+
final val MaxRecursions = 1000
implicit class ListDecorator[T](val xs: List[T]) extends AnyVal {