diff options
author | phaller <hallerp@gmail.com> | 2012-11-15 18:07:39 +0100 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-11-16 09:53:37 +0100 |
commit | 7e1441cd468191a1bbe9a03439951b7e3c2b508f (patch) | |
tree | 11501916af045630759604c654aaf58ebd3ed470 /src/main/scala | |
parent | c4ceea0ca8538297622634121b99e2357ca72acb (diff) | |
download | scala-async-7e1441cd468191a1bbe9a03439951b7e3c2b508f.tar.gz scala-async-7e1441cd468191a1bbe9a03439951b7e3c2b508f.tar.bz2 scala-async-7e1441cd468191a1bbe9a03439951b7e3c2b508f.zip |
Clean up and improve debug/error output
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/scala/async/AnfTransform.scala | 6 | ||||
-rw-r--r-- | src/main/scala/scala/async/Async.scala | 4 | ||||
-rw-r--r-- | src/main/scala/scala/async/ExprBuilder.scala | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/main/scala/scala/async/AnfTransform.scala b/src/main/scala/scala/async/AnfTransform.scala index 86dea75..aa62b77 100644 --- a/src/main/scala/scala/async/AnfTransform.scala +++ b/src/main/scala/scala/async/AnfTransform.scala @@ -21,8 +21,7 @@ class AnfTransform[C <: Context](val c: C) { val stats :+ expr = anf.transformToList(tree) expr match { - case Apply(fun, args) if { vprintln("check fun.toString: " + fun.toString); fun.toString.startsWith("scala.async.Async.await") } => - vprintln("found await!!") + case Apply(fun, args) if fun.toString.startsWith("scala.async.Async.await") => val liftedName = c.fresh("await$") stats :+ ValDef(NoMods, liftedName, TypeTree(), expr) :+ Ident(liftedName) @@ -43,7 +42,6 @@ class AnfTransform[C <: Context](val c: C) { stats :+ varDef :+ ifWithAssign :+ Ident(liftedName) case _ => - vprintln("found something else") stats :+ expr } } @@ -101,7 +99,7 @@ class AnfTransform[C <: Context](val c: C) { case ModuleDef(mods, name, impl) => List(tree) case _ => - println("do not handle tree "+tree) + c.error(tree.pos, "Internal error while compiling `async` block") ??? } } diff --git a/src/main/scala/scala/async/Async.scala b/src/main/scala/scala/async/Async.scala index 8fc7ccf..649e518 100644 --- a/src/main/scala/scala/async/Async.scala +++ b/src/main/scala/scala/async/Async.scala @@ -80,6 +80,8 @@ abstract class AsyncBase { val stats1 :+ expr1 = transform.anf.transformToList(typedBody) val btree = c.typeCheck(Block(stats1, expr1)) + AsyncUtils.vprintln(s"In file '${c.macroApplication.pos.source.path}':") + AsyncUtils.vprintln(s"${c.macroApplication}") AsyncUtils.vprintln(s"ANF transform expands to:\n $btree") val (stats, expr) = btree match { @@ -167,7 +169,7 @@ abstract class AsyncBase { // ... and return its Future from the macro. val result = futureSystemOps.promiseToFuture(prom) - AsyncUtils.vprintln(s"${c.macroApplication} \nexpands to:\n ${result.tree}") + AsyncUtils.vprintln(s"async state machine transform expands to:\n ${result.tree}") result } diff --git a/src/main/scala/scala/async/ExprBuilder.scala b/src/main/scala/scala/async/ExprBuilder.scala index 4ace31c..467169c 100644 --- a/src/main/scala/scala/async/ExprBuilder.scala +++ b/src/main/scala/scala/async/ExprBuilder.scala @@ -344,7 +344,6 @@ final class ExprBuilder[C <: Context, FS <: FutureSystem](val c: C, val futureSy stateBuilder = new builder.AsyncStateBuilder(currState, toRename.map { case (k, v) => (k.toString, v) }) case Match(scrutinee, cases) => - vprintln("transforming match expr: " + stat) checkForUnsupportedAwait(scrutinee) val matchBudget: Int = remainingBudget / 2 |