Created
January 30, 2016 02:20
-
-
Save matsu-chara/ffde9b1c14bff05179ac to your computer and use it in GitHub Desktop.
Xprintの例
This file contains hidden or 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
$ scalac -Xprint:typer Foo.scala | |
[[syntax trees at end of typer]] // Foo.scala | |
package <empty> { | |
object Main extends AnyRef with App { | |
def <init>(): Main.type = { | |
Main.super.<init>(); | |
() | |
}; | |
def foo(x: Option[Int]): Unit = x match { | |
case (x: Int)Some[Int]((a @ _)) => scala.this.Predef.println(a) | |
case scala.None => scala.this.Predef.println("null") | |
}; | |
Main.this.foo(scala.Some.apply[Int](3)) | |
} | |
} | |
$ scalac -Xprint:patmat Foo.scala | |
[[syntax trees at end of patmat]] // Foo.scala | |
package <empty> { | |
object Main extends AnyRef with App { | |
def <init>(): Main.type = { | |
Main.super.<init>(); | |
() | |
}; | |
def foo(x: Option[Int]): Unit = { | |
case <synthetic> val x1: Option[Int] = x; | |
case6(){ | |
if (x1.isInstanceOf[Some[Int]]) | |
{ | |
<synthetic> val x2: Some[Int] = (x1.asInstanceOf[Some[Int]]: Some[Int]); | |
{ | |
val a: Int = x2.x; | |
matchEnd5(scala.this.Predef.println(a)) | |
} | |
} | |
else | |
case7() | |
}; | |
case7(){ | |
if (scala.None.==(x1)) | |
matchEnd5(scala.this.Predef.println("null")) | |
else | |
case8() | |
}; | |
case8(){ | |
matchEnd5(throw new MatchError(x1)) | |
}; | |
matchEnd5(x: Unit){ | |
x | |
} | |
}; | |
Main.this.foo(scala.Some.apply[Int](3)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment