diff options
author | phaller <hallerp@gmail.com> | 2012-11-16 10:42:12 +0100 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-11-16 10:42:12 +0100 |
commit | 92717bda882903dca427cf95f83fcfde9e0d2322 (patch) | |
tree | 0913785f5562787689036884e73c90b18e73b8b7 /pending/run/fallback0/MinimalScalaTest.scala | |
parent | a0f1a6e7fa65634fb18eeecb9ac233ea18597320 (diff) | |
download | scala-async-92717bda882903dca427cf95f83fcfde9e0d2322.tar.gz scala-async-92717bda882903dca427cf95f83fcfde9e0d2322.tar.bz2 scala-async-92717bda882903dca427cf95f83fcfde9e0d2322.zip |
Generate cleaner code for Unit-typed if-else expressions
Instead of generating an assignment to a Unit-typed variable, just add
the Unit value after the if-else expression:
[async] scala.async.Async.async[Unit]({
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
State.result_=(scala.async.Async.await[Int](f).+(2))
else
State.result_=(scala.async.Async.await[Int](f).-(2))
})
[async] ANF transform expands to:
{
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
{
val await$8: Int = scala.async.Async.await[Int](f);
State.result_=(await$8.+(2))
}
else
{
val await$9: Int = scala.async.Async.await[Int](f);
State.result_=(await$9.-(2))
};
()
}
Diffstat (limited to 'pending/run/fallback0/MinimalScalaTest.scala')
0 files changed, 0 insertions, 0 deletions