Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Forked from okapies/gist:7182102
Last active December 26, 2015 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuwei-k/7182174 to your computer and use it in GitHub Desktop.
Save xuwei-k/7182174 to your computer and use it in GitHub Desktop.
[[syntax trees at end of jvm]] // Param.scala
package <empty> {
final class Param extends Object {
<paramaccessor> private[this] val i: Int = _;
<stable> <accessor> <paramaccessor> def i(): Int = Param.this.i;
override <synthetic> def hashCode(): Int = Param.hashCode$extension(Param.this.i());
override <synthetic> def equals(x$1: Object): Boolean = Param.equals$extension(Param.this.i(), x$1);
def <init>(i: Int): Param = {
Param.this.i = i;
Param.super.<init>();
()
}
};
object Param extends Object {
final private[this] val ConstantA: Int = _;
final <stable> <accessor> def ConstantA(): Int = Param.this.ConstantA;
final private[this] val ConstantB: Int = _;
final <stable> <accessor> def ConstantB(): Int = Param.this.ConstantB;
final <synthetic> def hashCode$extension($this: Int): Int = scala.Int.box($this).hashCode();
final <synthetic> def equals$extension($this: Int, x$1: Object): Boolean = {
case <synthetic> val x1: Object = x$1;
case5(){
if (x1.$isInstanceOf[Param]())
matchEnd4(true)
else
case6()
};
case6(){
matchEnd4(false)
};
matchEnd4(x: Boolean){
x
}
}.&&({
<synthetic> val Param$1: Int = x$1.$asInstanceOf[Param]().i();
$this.==(Param$1)
});
def <init>(): Param.type = {
Param.super.<init>();
Param.this.ConstantA = -1;
Param.this.ConstantB = 0;
()
}
};
object Main extends Object {
def foo(i: Int): Int = i;
def <init>(): Main.type = {
Main.super.<init>();
Main.this.foo(Param.ConstantA());
()
}
}
}
class Param(val i: Int) extends AnyVal
object Param{
final val ConstantA = new Param(-1)
final val ConstantB = new Param(0)
}
object Main{
def foo(i: Param) = i
foo(Param.ConstantA)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment