diff options
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/scala/async/internal/AsyncTransform.scala | 4 | ||||
-rw-r--r-- | src/main/scala/scala/async/internal/FutureSystem.scala | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/main/scala/scala/async/internal/AsyncTransform.scala b/src/main/scala/scala/async/internal/AsyncTransform.scala index 9003b0b..043822b 100644 --- a/src/main/scala/scala/async/internal/AsyncTransform.scala +++ b/src/main/scala/scala/async/internal/AsyncTransform.scala @@ -20,7 +20,9 @@ trait AsyncTransform { // Transform to A-normal form: // - no await calls in qualifiers or arguments, // - if/match only used in statement position. - val anfTree: Block = anfTransform(body) + val anfTree0: Block = anfTransform(body) + + val anfTree = futureSystemOps.postAnfTransform(anfTree0) val resumeFunTreeDummyBody = DefDef(Modifiers(), name.resume, Nil, List(Nil), Ident(definitions.UnitClass), Literal(Constant(()))) diff --git a/src/main/scala/scala/async/internal/FutureSystem.scala b/src/main/scala/scala/async/internal/FutureSystem.scala index 9fe88b4..c064474 100644 --- a/src/main/scala/scala/async/internal/FutureSystem.scala +++ b/src/main/scala/scala/async/internal/FutureSystem.scala @@ -51,6 +51,9 @@ trait FutureSystem { def spawn(tree: Tree, execContext: Tree): Tree = future(Expr[Unit](tree))(Expr[ExecContext](execContext)).tree + + /** A hook for custom macros to transform the tree post-ANF transform */ + def postAnfTransform(tree: Block): Block = tree } def mkOps(c: SymbolTable): Ops { val universe: c.type } |