diff options
Diffstat (limited to 'src/library/scala/runtime/ScalaRunTime.scala')
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 4d5f783d61..c8cc624468 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -199,6 +199,20 @@ object ScalaRunTime { } } + /** A helper for case classes. */ + def typedProductIterator[T](x: Product): Iterator[T] = { + new Iterator[T] { + private var c: Int = 0 + private val cmax = x.productArity + def hasNext = c < cmax + def next() = { + val result = x.productElement(c) + c += 1 + result.asInstanceOf[T] + } + } + } + /** Fast path equality method for inlining; used when -optimise is set. */ @inline def inlinedEquals(x: Object, y: Object): Boolean = |