diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-26 14:05:04 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-26 16:25:16 +0100 |
commit | be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4 (patch) | |
tree | 70426486df39db37860ab90f15ecb41ff51994c1 /src/main/scala/scala/async/FutureSystem.scala | |
parent | 4da04eee1893ead433a624f6b146d56aca46cb7e (diff) | |
download | scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.tar.gz scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.tar.bz2 scala-async-be275dcf295f0addf8d41c9a3b4cfe2acaadfaa4.zip |
Rewrite the state machine to a class, rather than an object.
To avoid suprises in tree retyping, the instance of this
class is immediately upcase to
StateMachine[Promise[T], ExecContext].
Allow nested non-case classes. These pop up when
we use nested async calls.
Only look for duplicate names in the subtrees
traversed by AsyncTraverser.
Diffstat (limited to 'src/main/scala/scala/async/FutureSystem.scala')
-rw-r--r-- | src/main/scala/scala/async/FutureSystem.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/scala/scala/async/FutureSystem.scala b/src/main/scala/scala/async/FutureSystem.scala index 20bbea3..e9373b3 100644 --- a/src/main/scala/scala/async/FutureSystem.scala +++ b/src/main/scala/scala/async/FutureSystem.scala @@ -33,6 +33,9 @@ trait FutureSystem { /** Lookup the execution context, typically with an implicit search */ def execContext: Expr[ExecContext] + def promType[A: WeakTypeTag]: Type + def execContextType: Type + /** Create an empty promise */ def createProm[A: WeakTypeTag]: Expr[Prom[A]] @@ -71,6 +74,9 @@ object ScalaConcurrentFutureSystem extends FutureSystem { case context => context }) + def promType[A: WeakTypeTag]: Type = c.weakTypeOf[Promise[A]] + def execContextType: Type = c.weakTypeOf[ExecutionContext] + def createProm[A: WeakTypeTag]: Expr[Prom[A]] = reify { Promise[A]() } @@ -113,6 +119,9 @@ object IdentityFutureSystem extends FutureSystem { def execContext: Expr[ExecContext] = c.literalUnit + def promType[A: WeakTypeTag]: Type = c.weakTypeOf[Prom[A]] + def execContextType: Type = c.weakTypeOf[Unit] + def createProm[A: WeakTypeTag]: Expr[Prom[A]] = reify { new Prom(null.asInstanceOf[A]) } |