aboutsummaryrefslogtreecommitdiff
path: root/src/async/library/scala/async/AsyncUtils.scala
blob: 98330a582b6551a7efb7e02c30af1558d7f45e48 (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
/**
 * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com>
 */
package scala.async

import scala.reflect.macros.Context

/*
 * @author Philipp Haller
 */
trait AsyncUtils {

  val verbose = true
  
  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"))
  }

}