1
0

diplomacy: add a hook for injecting code into LazyModule.module scope

This commit is contained in:
Wesley W. Terpstra 2017-10-26 15:19:05 -07:00
parent a060c37173
commit 60284082e7

View File

@ -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:_*)