aboutsummaryrefslogtreecommitdiff
path: root/src/async
diff options
context:
space:
mode:
Diffstat (limited to 'src/async')
-rw-r--r--src/async/library/scala/async/Async.scala13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/async/library/scala/async/Async.scala b/src/async/library/scala/async/Async.scala
index d6ebc47..5c42a16 100644
--- a/src/async/library/scala/async/Async.scala
+++ b/src/async/library/scala/async/Async.scala
@@ -314,16 +314,13 @@ object Async extends AsyncUtils {
var handlerExpr = c.Expr(handlerTree).asInstanceOf[c.Expr[PartialFunction[Int, Unit]]]
var i = 1
- while (asyncStates(i).isInstanceOf[builder.AsyncStateWithAwait]) {
+ for (asyncState <- asyncStates.tail.init) {
//val handlerForNextState = asyncStates(i).mkHandlerForState(i+1)
- val handlerTreeForNextState = asyncStates(i).mkHandlerTreeForState(i)
-
+ val handlerTreeForNextState = asyncState.mkHandlerTreeForState(i)
val currentHandlerTreeNaked = c.resetAllAttrs(handlerExpr.tree.duplicate)
- handlerExpr = reify {
- //c.Expr(currentHandlerTreeNaked).asInstanceOf[c.Expr[PartialFunction[Int, Unit]]].splice orElse handlerForNextState.splice
- c.Expr(currentHandlerTreeNaked).asInstanceOf[c.Expr[PartialFunction[Int, Unit]]].splice.orElse(
- c.Expr(handlerTreeForNextState).asInstanceOf[c.Expr[PartialFunction[Int, Unit]]].splice)
- }
+ handlerExpr = c.Expr(
+ Apply(Select(currentHandlerTreeNaked, newTermName("orElse")), List(handlerTreeForNextState))
+ ).asInstanceOf[c.Expr[PartialFunction[Int, Unit]]]
i += 1
}
// asyncStates(i) does not end with `await` (asyncStates(i).awaitable == null)