Skip to content

Commit 923b662

Browse files
committed
Add a hook for future systems to get the Graphviz diagnostic
1 parent e70da60 commit 923b662

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/main/scala/scala/async/internal/AsyncTransform.scala

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ trait AsyncTransform {
115115
if(AsyncUtils.verbose) {
116116
logDiagnostics(anfTree, asyncBlock, asyncBlock.asyncStates.map(_.toString))
117117
}
118+
futureSystemOps.dot(enclosingOwner, body).foreach(f => f(asyncBlock.toDot))
118119
cleanupContainsAwaitAttachments(result)
119120
}
120121

src/main/scala/scala/async/internal/FutureSystem.scala

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ trait FutureSystem {
7171

7272
/** A hook for custom macros to transform the tree post-ANF transform */
7373
def postAnfTransform(tree: Block): Block = tree
74+
75+
/** A hook for custom macros to selectively generate and process a Graphviz visualization of the transformed state machine */
76+
def dot(enclosingOwner: Symbol, macroApplication: Tree): Option[(String => Unit)] = None
7477
}
7578

7679
def mkOps(c0: Context): Ops { val c: c0.type }

0 commit comments

Comments
 (0)