aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scala/async/Async.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-22 11:33:23 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-22 11:33:23 +0100
commite126dc2ded320c81868e6456853f1ecd2629c495 (patch)
treec1c872787723531a321b6ccc8be4e55c323a17e5 /src/main/scala/scala/async/Async.scala
parent7f8e9876ca83db4ed7792f09f218b341fbc6c2b2 (diff)
downloadscala-async-e126dc2ded320c81868e6456853f1ecd2629c495.tar.gz
scala-async-e126dc2ded320c81868e6456853f1ecd2629c495.tar.bz2
scala-async-e126dc2ded320c81868e6456853f1ecd2629c495.zip
Frugality is no longer required with state IDs.
Change the way state IDs are allocated to avoid the need to ration them out. Also make the logging tolerant of a toolbox setting that doesn't have a source file.
Diffstat (limited to 'src/main/scala/scala/async/Async.scala')
-rw-r--r--src/main/scala/scala/async/Async.scala17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/scala/scala/async/Async.scala b/src/main/scala/scala/async/Async.scala
index bad693d..f9ed27e 100644
--- a/src/main/scala/scala/async/Async.scala
+++ b/src/main/scala/scala/async/Async.scala
@@ -52,11 +52,11 @@ abstract class AsyncBase {
/**
* A call to `await` must be nested in an enclosing `async` block.
- *
+ *
* A call to `await` does not block the current thread, rather it is a delimiter
* used by the enclosing `async` macro. Code following the `await`
* call is executed asynchronously, when the argument of `await` has been completed.
- *
+ *
* @param awaitable the future from which a value is awaited.
* @tparam T the type of that value.
* @return the value.
@@ -88,7 +88,14 @@ abstract class AsyncBase {
(vd.symbol, builder.name.fresh(vd.name))
}.toMap
- AsyncUtils.vprintln(s"In file '${c.macroApplication.pos.source.path}':")
+ def location = try {
+ c.macroApplication.pos.source.path
+ } catch {
+ case _: UnsupportedOperationException =>
+ c.macroApplication.pos.toString
+ }
+
+ AsyncUtils.vprintln(s"In file '$location':")
AsyncUtils.vprintln(s"${c.macroApplication}")
AsyncUtils.vprintln(s"ANF transform expands to:\n $btree")
@@ -96,8 +103,10 @@ abstract class AsyncBase {
case Block(stats, expr) => (stats, expr)
case tree => (Nil, tree)
}
+ val startState = builder.stateAssigner.nextState()
+ val endState = Int.MaxValue
- val asyncBlockBuilder = new builder.AsyncBlockBuilder(stats, expr, 0, 1000, 1000, renameMap)
+ val asyncBlockBuilder = new builder.AsyncBlockBuilder(stats, expr, startState, endState, renameMap)
asyncBlockBuilder.asyncStates foreach (s => AsyncUtils.vprintln(s))