Skip to content

Commit

Permalink
Merge two conditional due to same body (#4192)
Browse files Browse the repository at this point in the history
`shouldMatchModule(tpe)` and `shouldMatchInstance(tpe)` conditional body are the same, merge for concise.
  • Loading branch information
colin4124 authored Jun 20, 2024
1 parent b6c0411 commit 6e8d43c
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,8 @@ class ChiselComponent(val global: Global, arguments: ChiselPluginArguments)

treeCopy.ValDef(dd, mods, name, tpt, localTyper.typed(named))
}
// If an instance, just get a name but no prefix
else if (shouldMatchModule(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 if (shouldMatchInstance(tpe)) {
// If an instance or module, just get a name but no prefix
else if (shouldMatchModule(tpe) || shouldMatchInstance(tpe)) {
val str = stringFromTermName(name)
val newRHS = transform(rhs)
val named = q"chisel3.internal.plugin.autoNameRecursively($str)($newRHS)"
Expand Down

0 comments on commit 6e8d43c

Please sign in to comment.