aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scala/async/internal/FutureSystem.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-02-14 23:25:52 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-02-15 13:05:57 +0100
commitb792b509cd891b42c88406fcf88176f35e057f37 (patch)
tree0464cc13993ba7a7104a87be8ea2259aeb570e79 /src/main/scala/scala/async/internal/FutureSystem.scala
parent46621c4b934d580e0778bcf8d7ba118c73f644c0 (diff)
downloadscala-async-b792b509cd891b42c88406fcf88176f35e057f37.tar.gz
scala-async-b792b509cd891b42c88406fcf88176f35e057f37.tar.bz2
scala-async-b792b509cd891b42c88406fcf88176f35e057f37.zip
cleans up FutureSystem
Diffstat (limited to 'src/main/scala/scala/async/internal/FutureSystem.scala')
-rw-r--r--src/main/scala/scala/async/internal/FutureSystem.scala21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/scala/scala/async/internal/FutureSystem.scala b/src/main/scala/scala/async/internal/FutureSystem.scala
index 46c0bcf..1b1ffc3 100644
--- a/src/main/scala/scala/async/internal/FutureSystem.scala
+++ b/src/main/scala/scala/async/internal/FutureSystem.scala
@@ -4,7 +4,7 @@
package scala.async.internal
import scala.language.higherKinds
-import scala.reflect.internal.SymbolTable
+import scala.reflect.macros.Context
/**
* An abstraction over a future system.
@@ -27,10 +27,8 @@ trait FutureSystem {
type Tryy[T]
trait Ops {
- val universe: reflect.internal.SymbolTable
-
- import universe._
- def Expr[T: WeakTypeTag](tree: Tree): Expr[T] = universe.Expr[T](rootMirror, universe.FixedMirrorTreeCreator(rootMirror, tree))
+ val c: Context
+ import c.universe._
def promType[A: WeakTypeTag]: Type
def tryType[A: WeakTypeTag]: Type
@@ -53,7 +51,7 @@ trait FutureSystem {
def completeProm[A](prom: Expr[Prom[A]], value: Expr[Tryy[A]]): Expr[Unit]
def spawn(tree: Tree, execContext: Tree): Tree =
- future(Expr[Unit](tree))(Expr[ExecContext](execContext)).tree
+ future(c.Expr[Unit](tree))(c.Expr[ExecContext](execContext)).tree
def tryyIsFailure[A](tryy: Expr[Tryy[A]]): Expr[Boolean]
@@ -65,7 +63,7 @@ trait FutureSystem {
def postAnfTransform(tree: Block): Block = tree
}
- def mkOps(c: SymbolTable): Ops { val universe: c.type }
+ def mkOps(c0: Context): Ops { val c: c0.type }
}
object ScalaConcurrentFutureSystem extends FutureSystem {
@@ -77,10 +75,9 @@ object ScalaConcurrentFutureSystem extends FutureSystem {
type ExecContext = ExecutionContext
type Tryy[A] = scala.util.Try[A]
- def mkOps(c: SymbolTable): Ops {val universe: c.type} = new Ops {
- val universe: c.type = c
-
- import universe._
+ def mkOps(c0: Context): Ops {val c: c0.type} = new Ops {
+ val c: c0.type = c0
+ import c.universe._
def promType[A: WeakTypeTag]: Type = weakTypeOf[Promise[A]]
def tryType[A: WeakTypeTag]: Type = weakTypeOf[scala.util.Try[A]]
@@ -105,7 +102,7 @@ object ScalaConcurrentFutureSystem extends FutureSystem {
def completeProm[A](prom: Expr[Prom[A]], value: Expr[scala.util.Try[A]]): Expr[Unit] = reify {
prom.splice.complete(value.splice)
- Expr[Unit](Literal(Constant(()))).splice
+ c.Expr[Unit](Literal(Constant(()))).splice
}
def tryyIsFailure[A](tryy: Expr[scala.util.Try[A]]): Expr[Boolean] = reify {