aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/ir
diff options
context:
space:
mode:
authorchick2018-05-24 13:34:25 -0700
committerJack Koenig2018-05-30 14:17:28 -0700
commit430a8afb2cf42e9eef438c7ea38934113de0bbcf (patch)
tree0b1606e7e6caa6f0491d3c17ae10e7cee30bd7fe /src/main/scala/firrtl/ir
parentf24a733dc279e93a7d5d945042ec7472a6872aa1 (diff)
Makes ExpandWhens preserve connect Infos
* Collects Infos found for symbols * Merges multiple sources for symbol into MultiInfo * Restores these Infos on connect statements. * Add test showing preserved Infos * Changed ++ methods on the Info sub-classes * Ignore NoInfo being added * Fixed way adding was implemented in MultiInfo * Made InfoMap a class which defines the default value function
Diffstat (limited to 'src/main/scala/firrtl/ir')
-rw-r--r--src/main/scala/firrtl/ir/IR.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/ir/IR.scala b/src/main/scala/firrtl/ir/IR.scala
index 53fbb765..3887f17d 100644
--- a/src/main/scala/firrtl/ir/IR.scala
+++ b/src/main/scala/firrtl/ir/IR.scala
@@ -21,7 +21,8 @@ case object NoInfo extends Info {
}
case class FileInfo(info: StringLit) extends Info {
override def toString: String = " @[" + info.serialize + "]"
- def ++(that: Info): Info = MultiInfo(Seq(this, that))
+ //scalastyle:off method.name
+ def ++(that: Info): Info = if (that == NoInfo) this else MultiInfo(Seq(this, that))
}
case class MultiInfo(infos: Seq[Info]) extends Info {
private def collectStringLits(info: Info): Seq[StringLit] = info match {
@@ -34,7 +35,8 @@ case class MultiInfo(infos: Seq[Info]) extends Info {
if (parts.nonEmpty) parts.map(_.serialize).mkString(" @[", " ", "]")
else ""
}
- def ++(that: Info): Info = MultiInfo(Seq(this, that))
+ //scalastyle:off method.name
+ def ++(that: Info): Info = if (that == NoInfo) this else MultiInfo(infos :+ that)
}
object MultiInfo {
def apply(infos: Info*) = {