diff options
| -rw-r--r-- | core/src/main/scala/chisel3/Aggregate.scala | 2 | ||||
| -rw-r--r-- | plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/core/src/main/scala/chisel3/Aggregate.scala b/core/src/main/scala/chisel3/Aggregate.scala index 75966a16..ec64f28b 100644 --- a/core/src/main/scala/chisel3/Aggregate.scala +++ b/core/src/main/scala/chisel3/Aggregate.scala @@ -1254,7 +1254,7 @@ abstract class Bundle(implicit compileOptions: CompileOptions) extends Record { /* * This method will be overwritten by the Chisel-Plugin */ - protected def _elementsImpl: SeqMap[String, Any] = { + protected def _elementsImpl: Iterable[(String, Any)] = { val nameMap = LinkedHashMap[String, Data]() for (m <- getPublicFields(classOf[Bundle])) { getBundleField(m) match { diff --git a/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala b/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala index e92bbb23..d768175d 100644 --- a/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala +++ b/plugin/src/main/scala/chisel3/internal/plugin/BundleComponent.scala @@ -41,12 +41,12 @@ private[plugin] class BundleComponent(val global: Global, arguments: ChiselPlugi def inferType(t: Tree): Type = localTyper.typed(t, nsc.Mode.TYPEmode).tpe - val bundleTpe: Type = inferType(tq"chisel3.Bundle") - val dataTpe: Type = inferType(tq"chisel3.Data") - val ignoreSeqTpe: Type = inferType(tq"chisel3.IgnoreSeqInBundle") - val seqOfDataTpe: Type = inferType(tq"scala.collection.Seq[chisel3.Data]") - val someOfDataTpe: Type = inferType(tq"scala.Option[chisel3.Data]") - val seqMapTpe: Type = inferType(tq"scala.collection.immutable.SeqMap[String,Any]") + val bundleTpe: Type = inferType(tq"chisel3.Bundle") + val dataTpe: Type = inferType(tq"chisel3.Data") + val ignoreSeqTpe: Type = inferType(tq"chisel3.IgnoreSeqInBundle") + val seqOfDataTpe: Type = inferType(tq"scala.collection.Seq[chisel3.Data]") + val someOfDataTpe: Type = inferType(tq"scala.Option[chisel3.Data]") + val itStringAnyTpe: Type = inferType(tq"scala.collection.Iterable[(String,Any)]") // Not cached because it should only be run once per class (thus once per Type) def isBundle(sym: Symbol): Boolean = { sym.tpe <:< bundleTpe } @@ -95,6 +95,9 @@ private[plugin] class BundleComponent(val global: Global, arguments: ChiselPlugi case d: DefDef if isNullaryMethodNamed("_cloneTypeImpl", d) => val msg = "Users cannot override _cloneTypeImpl. Let the compiler plugin generate it." global.globalError(d.pos, msg) + case d: DefDef if isNullaryMethodNamed("_elementsImpl", d) => + val msg = "Users cannot override _elementsImpl. Let the compiler plugin generate it." + global.globalError(d.pos, msg) case d: DefDef if isNullaryMethodNamed("_usingPlugin", d) => val msg = "Users cannot override _usingPlugin, it is for the compiler plugin's use only." global.globalError(d.pos, msg) @@ -220,10 +223,10 @@ private[plugin] class BundleComponent(val global: Global, arguments: ChiselPlugi val elementsImplSym = bundle.symbol.newMethod(TermName("_elementsImpl"), bundle.symbol.pos.focus, Flag.OVERRIDE | Flag.PROTECTED) elementsImplSym.resetFlag(Flags.METHOD) - elementsImplSym.setInfo(NullaryMethodType(seqMapTpe)) + elementsImplSym.setInfo(NullaryMethodType(itStringAnyTpe)) val elementsImpl = localTyper.typed( - DefDef(elementsImplSym, q"scala.collection.immutable.SeqMap.apply[String, Any](..$elementArgs)") + DefDef(elementsImplSym, q"scala.collection.immutable.Vector.apply[(String, Any)](..$elementArgs)") ) Some(elementsImpl) |
