diff options
author | Martin Odersky <odersky@gmail.com> | 2013-01-24 15:20:28 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-01-24 15:21:16 +0100 |
commit | 8621d34646e15b14ffd7ac2a7a8ca6eb587b1426 (patch) | |
tree | 454706fcc58e239ede1dcdb7c67d8bfe8ccc2169 /src/dotty/tools/dotc/core/Decorators.scala | |
parent | 6ed74c3a2f38aadfb0bf2110cae00309b9050708 (diff) | |
download | dotty-8621d34646e15b14ffd7ac2a7a8ca6eb587b1426.tar.gz dotty-8621d34646e15b14ffd7ac2a7a8ca6eb587b1426.tar.bz2 dotty-8621d34646e15b14ffd7ac2a7a8ca6eb587b1426.zip |
Various additions to symbols, denotations, and elsewhere
Diffstat (limited to 'src/dotty/tools/dotc/core/Decorators.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Decorators.scala | 13 |
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 { |