From 60284082e7b747f3b83e170e2721348c69a4eefb Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Thu, 26 Oct 2017 15:19:05 -0700 Subject: [PATCH] diplomacy: add a hook for injecting code into LazyModule.module scope --- src/main/scala/diplomacy/LazyModule.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/scala/diplomacy/LazyModule.scala b/src/main/scala/diplomacy/LazyModule.scala index 1903dec7..48243e61 100644 --- a/src/main/scala/diplomacy/LazyModule.scala +++ b/src/main/scala/diplomacy/LazyModule.scala @@ -63,6 +63,7 @@ abstract class LazyModule()(implicit val p: Parameters) def name = valName.getOrElse(className) def line = sourceLine(info) + def instantiate() { } // a hook for running things in module scope (after children exist, but before dangles+auto exists) def module: LazyModuleImpLike def omitGraphML: Boolean = !nodes.exists(!_.omitGraphML) && !children.exists(!_.omitGraphML) @@ -163,6 +164,7 @@ sealed trait LazyModuleImpLike extends BaseModule implicit val sourceInfo = c.info Module(c.module).dangles } + wrapper.instantiate() val nodeDangles = wrapper.nodes.reverse.flatMap(_.instantiate()) val allDangles = nodeDangles ++ childDangles val pairing = SortedMap(allDangles.groupBy(_.source).toSeq:_*)