blob: d288d3499f71a6104ffdfd14b31bebec58b4124e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/**
* 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"))
}
protected def awaitCpsSym(c: Context): c.universe.Symbol = {
val asyncMod = c.mirror.staticModule("scala.async.Async")
val tpe = asyncMod.moduleClass.asType.toType
tpe.member(c.universe.newTermName("awaitCps"))
}
}
|