summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-12 13:59:56 +0000
committerPaul Phillips <paulp@improving.org>2009-11-12 13:59:56 +0000
commit5995692ffd9bd401589117b10029b63503cad6be (patch)
tree46e93557da197869f3d7ae4bf513782f4c03e19d /src/compiler/scala/tools/nsc/ast/TreeDSL.scala
parent6720ae4cbcda0f2a8b956709690fd09dd45da3d4 (diff)
downloadscala-5995692ffd9bd401589117b10029b63503cad6be.tar.gz
scala-5995692ffd9bd401589117b10029b63503cad6be.tar.bz2
scala-5995692ffd9bd401589117b10029b63503cad6be.zip
Removed some duplicated functions.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeDSL.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index c5cef0dd32..569b0f7b37 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -18,24 +18,13 @@ trait TreeDSL {
import global._
import definitions._
import gen.{ scalaDot }
+ import PartialFunction._
object CODE {
// Add a null check to a Tree => Tree function
def nullSafe[T](f: Tree => Tree, ifNull: Tree): Tree => Tree =
tree => IF (tree MEMBER_== NULL) THEN ifNull ELSE f(tree)
- // XXX these two are in scala.PartialFunction now, just have to
- // settle on the final names.
-
- // Create a conditional based on a partial function - for values not defined
- // on the partial, it is false.
- def cond[T](x: T)(f: PartialFunction[T, Boolean]) = (f isDefinedAt x) && f(x)
-
- // Like cond, but transforms the value T => Some(U) if the pf is defined,
- // or returns None if it is not.
- def condOpt[T,U](x: T)(f: PartialFunction[T, U]): Option[U] =
- if (f isDefinedAt x) Some(f(x)) else None
-
// Applies a function to a value and then returns the value.
def returning[T](f: T => Unit)(x: T): T = { f(x) ; x }