summaryrefslogtreecommitdiff
path: root/plugin/src/main/scala
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/main/scala')
-rw-r--r--plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala b/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala
index b1302ba3..af22e6a7 100644
--- a/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala
+++ b/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala
@@ -82,6 +82,7 @@ class ChiselComponent(val global: Global) extends PluginComponent with TypingTra
private val shouldMatchData : Type => Boolean = shouldMatchGen(tq"chisel3.Data")
private val shouldMatchDataOrMem : Type => Boolean = shouldMatchGen(tq"chisel3.Data", tq"chisel3.MemBase[_]")
private val shouldMatchModule : Type => Boolean = shouldMatchGen(tq"chisel3.experimental.BaseModule")
+ private val shouldMatchInstance : Type => Boolean = shouldMatchGen(tq"chisel3.experimental.hierarchy.Instance[_]")
// Given a type tree, infer the type and return it
private def inferType(t: Tree): Type = localTyper.typed(t, nsc.Mode.TYPEmode).tpe
@@ -188,6 +189,11 @@ class ChiselComponent(val global: Global) extends PluginComponent with TypingTra
val newRHS = transform(rhs)
val named = q"chisel3.internal.plugin.autoNameRecursively($str)($newRHS)"
treeCopy.ValDef(dd, mods, name, tpt, localTyper typed named)
+ } else if (shouldMatchInstance(tpe)) {
+ val str = stringFromTermName(name)
+ val newRHS = transform(rhs)
+ val named = q"chisel3.internal.plugin.autoNameRecursively($str)($newRHS)"
+ treeCopy.ValDef(dd, mods, name, tpt, localTyper typed named)
} else {
// Otherwise, continue
super.transform(tree)