summaryrefslogtreecommitdiff
path: root/src/library/scala/PartialFunction.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-18 00:59:00 -0700
committerPaul Phillips <paulp@improving.org>2012-09-18 02:19:12 -0700
commit0e061f420f3b6e7447658f003d00f6108fa649e0 (patch)
tree0b8593545df932f08b051441112ce2ae2f6804e3 /src/library/scala/PartialFunction.scala
parent66603a2c003852d39faec20a9763fb0e25049cf4 (diff)
downloadscala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.gz
scala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.bz2
scala-0e061f420f3b6e7447658f003d00f6108fa649e0.zip
Removed many @inline annotations and final modifiers.
It is my belief that these @inlines and finals landed between unhelpful and harmful. I am sure this will be disputed in some cases. It's too much and too difficult to measure except in the aggregate unless we have specific @inline sites to discuss. I don't know upon whom the burden of proof lies. I think we should err on the side given here, since there is no evidence of any consistent rationale being applied and it is easy to verify the negative impact scala compiler inlining can have on hotspot's far more sophisticated inlining.
Diffstat (limited to 'src/library/scala/PartialFunction.scala')
-rw-r--r--src/library/scala/PartialFunction.scala18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala
index 7c6e2d2e3e..ce109626cc 100644
--- a/src/library/scala/PartialFunction.scala
+++ b/src/library/scala/PartialFunction.scala
@@ -156,7 +156,7 @@ trait PartialFunction[-A, +B] extends (A => B) { self =>
object PartialFunction {
/** Composite function produced by `PartialFunction#orElse` method
*/
- private final class OrElse[-A, +B] (f1: PartialFunction[A, B], f2: PartialFunction[A, B]) extends PartialFunction[A, B] {
+ private class OrElse[-A, +B] (f1: PartialFunction[A, B], f2: PartialFunction[A, B]) extends PartialFunction[A, B] {
def isDefinedAt(x: A) = f1.isDefinedAt(x) || f2.isDefinedAt(x)
def apply(x: A): B = f1.applyOrElse(x, f2)
@@ -175,7 +175,7 @@ object PartialFunction {
/** Composite function produced by `PartialFunction#andThen` method
*/
- private final class AndThen[-A, B, +C] (pf: PartialFunction[A, B], k: B => C) extends PartialFunction[A, C] {
+ private class AndThen[-A, B, +C] (pf: PartialFunction[A, B], k: B => C) extends PartialFunction[A, C] {
def isDefinedAt(x: A) = pf.isDefinedAt(x)
def apply(x: A): C = k(pf(x))
@@ -207,11 +207,11 @@ object PartialFunction {
*
* Here `fallback_pf` is used as both unique marker object and special fallback function that returns it.
*/
- private[this] final val fallback_pf: PartialFunction[Any, Any] = { case _ => fallback_pf }
- @inline private final def checkFallback[B] = fallback_pf.asInstanceOf[PartialFunction[Any, B]]
- @inline private final def fallbackOccurred[B](x: B) = (fallback_pf eq x.asInstanceOf[AnyRef])
+ private[this] val fallback_pf: PartialFunction[Any, Any] = { case _ => fallback_pf }
+ private def checkFallback[B] = fallback_pf.asInstanceOf[PartialFunction[Any, B]]
+ private def fallbackOccurred[B](x: B) = (fallback_pf eq x.asInstanceOf[AnyRef])
- private final class Lifted[-A, +B] (val pf: PartialFunction[A, B])
+ private class Lifted[-A, +B] (val pf: PartialFunction[A, B])
extends scala.runtime.AbstractFunction1[A, Option[B]] {
def apply(x: A): Option[B] = {
@@ -220,7 +220,7 @@ object PartialFunction {
}
}
- private final class Unlifted[A, B] (f: A => Option[B]) extends scala.runtime.AbstractPartialFunction[A, B] {
+ private class Unlifted[A, B] (f: A => Option[B]) extends scala.runtime.AbstractPartialFunction[A, B] {
def isDefinedAt(x: A): Boolean = f(x).isDefined
override def applyOrElse[A1 <: A, B1 >: B](x: A1, default: A1 => B1): B1 = {
@@ -241,9 +241,9 @@ object PartialFunction {
*/
def apply[A, B](f: A => B): PartialFunction[A, B] = { case x => f(x) }
- private[this] final val constFalse: Any => Boolean = { _ => false}
+ private[this] val constFalse: Any => Boolean = { _ => false}
- private[this] final val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] {
+ private[this] val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] {
def isDefinedAt(x: Any) = false
def apply(x: Any) = throw new MatchError(x)
override def orElse[A1, B1](that: PartialFunction[A1, B1]) = that