Skip to content

Commit

Permalink
Remove unnecessary method and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
smithjessk committed Aug 15, 2016
1 parent d80fe90 commit 4265c15
Showing 1 changed file with 16 additions and 24 deletions.
Expand Up @@ -66,16 +66,29 @@ object AsyncAwait {
p.future
}

def validate[C <: Context](c: C)(body: c.Tree) {
/** Wraps `body` inside a coroutine and asynchronously invokes it using `asyncMacro`.
*
* @param body The block of code to wrap inside an asynchronous coroutine.
* @return A `Future` wrapping the result of `body`.
*/
def async[Y, R](body: =>R): Future[R] = macro asyncMacro[Y, R]

/** Implements `async`.
*
* Wraps `body` inside a coroutine and calls `asyncCall`.
*
* @param body The function to be wrapped in a coroutine.
* @return A tree that contains an invocation of `asyncCall` on a coroutine
* with `body` as its body.
*/
def asyncMacro[Y, R](c: Context)(body: c.Tree): c.Tree = {
import c.universe._

/** Ensures that no values are yielded inside the async block.
*
* It is similar to and shares functionality with
* [[org.coroutines.AstCanonicalization.NestedContextValidator]].
*
* @param typer Holds the typings for the body of the coroutine. Can be generated
* using `org.coroutines.common.ByTreeTyper`.
*/
class NoYieldsValidator extends Traverser {
// return type is the lub of the function return type and yield argument types
Expand Down Expand Up @@ -104,27 +117,6 @@ object AsyncAwait {
}

new NoYieldsValidator().traverse(body)
}

/** Wraps `body` inside a coroutine and asynchronously invokes it using `asyncMacro`.
*
* @param body The block of code to wrap inside an asynchronous coroutine.
* @return A `Future` wrapping the result of `body`.
*/
def async[Y, R](body: =>R): Future[R] = macro asyncMacro[Y, R]

/** Implements `async`.
*
* Wraps `body` inside a coroutine and calls `asyncCall`.
*
* @param body The function to be wrapped in a coroutine.
* @return A tree that contains an invocation of `asyncCall` on a coroutine
* with `body` as its body.
*/
def asyncMacro[Y, R](c: Context)(body: c.Tree): c.Tree = {
import c.universe._

validate(c)(body)

q"""
val c = coroutine { () =>
Expand Down

0 comments on commit 4265c15

Please sign in to comment.