aboutsummaryrefslogtreecommitdiff
path: root/src/async/library/scala/async/AsyncUtils.scala
diff options
context:
space:
mode:
authorphaller <hallerp@gmail.com>2012-09-11 08:52:46 +0200
committerphaller <hallerp@gmail.com>2012-09-11 08:52:46 +0200
commitdfe2c75dadc61e46053f6bb602c152896f942974 (patch)
tree94ec7b51d7424c73363c3210f6cc644943a52edb /src/async/library/scala/async/AsyncUtils.scala
downloadscala-async-dfe2c75dadc61e46053f6bb602c152896f942974.tar.gz
scala-async-dfe2c75dadc61e46053f6bb602c152896f942974.tar.bz2
scala-async-dfe2c75dadc61e46053f6bb602c152896f942974.zip
Import some initial code for async macro
Diffstat (limited to 'src/async/library/scala/async/AsyncUtils.scala')
-rw-r--r--src/async/library/scala/async/AsyncUtils.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/async/library/scala/async/AsyncUtils.scala b/src/async/library/scala/async/AsyncUtils.scala
new file mode 100644
index 0000000..820541b
--- /dev/null
+++ b/src/async/library/scala/async/AsyncUtils.scala
@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com>
+ */
+package scala.async
+
+import scala.reflect.macros.Context
+
+/*
+ * @author Philipp Haller
+ */
+trait AsyncUtils {
+
+ val verbose = false
+
+ protected def vprintln(s: Any): Unit = if (verbose)
+ println("[async] "+s)
+
+ /* Symbol of the `Async.await` method in context `c`.
+ */
+ protected def awaitSym(c: Context): c.universe.Symbol = {
+ val asyncMod = c.mirror.staticModule("scala.async.Async")
+ val tpe = asyncMod.moduleClass.asType.toType
+ tpe.member(c.universe.newTermName("await"))
+ }
+
+}