diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-09 18:33:13 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-09 18:33:13 +0100 |
commit | 6226c3583b742e0576e5c598fba4e64622c99165 (patch) | |
tree | e54878ce719641166bb13c36bd9ec2f1d5047489 /src/main/scala/scala/async/Async.scala | |
parent | 566102b23cd08f2b6af60121feb28013288a0951 (diff) | |
download | scala-async-6226c3583b742e0576e5c598fba4e64622c99165.tar.gz scala-async-6226c3583b742e0576e5c598fba4e64622c99165.tar.bz2 scala-async-6226c3583b742e0576e5c598fba4e64622c99165.zip |
Avoid hygiene problems by suffixing result/result/state.
Perhaps we should freshen them, but that will be a little awkward in our reify block.
Diffstat (limited to 'src/main/scala/scala/async/Async.scala')
-rw-r--r-- | src/main/scala/scala/async/Async.scala | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/scala/scala/async/Async.scala b/src/main/scala/scala/async/Async.scala index e8f5263..0a3bbbf 100644 --- a/src/main/scala/scala/async/Async.scala +++ b/src/main/scala/scala/async/Async.scala @@ -129,19 +129,25 @@ abstract class AsyncBase extends AsyncUtils { val prom: Expr[futureSystem.Prom[T]] = reify { - val result = futureSystemOps.createProm[T].splice - var state = 0 + val result$async = futureSystemOps.createProm[T].splice + var state$async = 0 futureSystemOps.future[Unit] { c.Expr[Unit](Block( localVarTrees :+ resumeFunTree, Apply(Ident(name.resume), List()))) }(futureSystemOps.execContext).splice - result + result$async } val result = futureSystemOps.promiseToFuture(prom) - // println(s"${c.macroApplication} \nexpands to:\n ${result.tree}") +// println(s"${c.macroApplication} \nexpands to:\n ${result.tree}") +// val positions = result.tree.collect { +// case t => (t.toString.take(10).replaceAll("\n", "\\n"), t.pos) +// } +// println(positions.mkString("\n")) + result + case tree => c.abort(c.macroApplication.pos, s"expression not supported by async: ${tree}") } |