Created
March 23, 2018 08:10
-
-
Save optician/aab7f52c9c1ce0e6b60fec64456fb692 to your computer and use it in GitHub Desktop.
PartialFunction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A{ | |
val x: PartialFunction[Any, Int] = { | |
case Some(x: Int) => x | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[syntax trees at end of cleanup]] // a.scala | |
package <empty> { | |
class A extends Object { | |
private[this] val x: PartialFunction = _; | |
<stable> <accessor> def x(): PartialFunction = A.this.x; | |
def <init>(): A = { | |
A.super.<init>(); | |
A.this.x = ({ | |
new <$anon: Function1>(A.this) | |
}: PartialFunction); | |
() | |
} | |
}; | |
@SerialVersionUID(value = 0) final <synthetic> class anonfun$1 extends scala.runtime.AbstractPartialFunction with Serializable { | |
final override def applyOrElse(x1: Object, default: Function1): Object = { | |
case <synthetic> val x1: Object = (((x1: Object): Object): Object); | |
case6(){ | |
if (x1.$isInstanceOf[Some]()) | |
{ | |
<synthetic> val x2: Some = (x1.$asInstanceOf[Some](): Some); | |
{ | |
val x: Object = x2.value(); | |
if (x.$isInstanceOf[Int]()) | |
{ | |
<synthetic> val x3: Int = (scala.Int.unbox(x): Int); | |
matchEnd5(scala.Int.box(x3)) | |
} | |
else | |
case7() | |
} | |
} | |
else | |
case7() | |
}; | |
case7(){ | |
matchEnd5(default.apply(x1)) | |
}; | |
matchEnd5(x: Object){ | |
x | |
} | |
}; | |
final def isDefinedAt(x1: Object): Boolean = { | |
case <synthetic> val x1: Object = (((x1: Object): Object): Object); | |
case6(){ | |
if (x1.$isInstanceOf[Some]()) | |
{ | |
<synthetic> val x2: Some = (x1.$asInstanceOf[Some](): Some); | |
{ | |
val x: Object = x2.value(); | |
if (x.$isInstanceOf[Int]()) | |
matchEnd5(true) | |
else | |
case7() | |
} | |
} | |
else | |
case7() | |
}; | |
case7(){ | |
matchEnd5(false) | |
}; | |
matchEnd5(x: Boolean){ | |
x | |
} | |
}; | |
def <init>($outer: A): <$anon: Function1> = { | |
anonfun$1.super.<init>(); | |
() | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment