From e8e84ba8d3e3ebf266250cdb48176a9fef5361d9 Mon Sep 17 00:00:00 2001 From: phaller Date: Wed, 19 Dec 2012 00:22:13 +0100 Subject: New fix for #1861: Add fall-back to CPS for all unsupported uses of await This is a re-implementation of a previous fix. It is more modular, since it enables the definition of a CPS-based fall-back as a subclass of `AsyncBase`. Thus, it's possible to define fall-back-enabled subclasses of `AsyncBase` targetting not only Scala Futures. --- src/main/scala/scala/async/FutureSystem.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/scala/scala/async/FutureSystem.scala') diff --git a/src/main/scala/scala/async/FutureSystem.scala b/src/main/scala/scala/async/FutureSystem.scala index e9373b3..f0b4653 100644 --- a/src/main/scala/scala/async/FutureSystem.scala +++ b/src/main/scala/scala/async/FutureSystem.scala @@ -51,9 +51,12 @@ trait FutureSystem { /** Complete a promise with a value */ def completeProm[A](prom: Expr[Prom[A]], value: Expr[scala.util.Try[A]]): Expr[Unit] + + def spawn(tree: context.Tree): context.Tree = + future(context.Expr[Unit](tree))(execContext).tree } - def mkOps(c: Context): Ops {val context: c.type} + def mkOps(c: Context): Ops { val context: c.type } } object ScalaConcurrentFutureSystem extends FutureSystem { -- cgit v1.2.3