diff options
| author | Adam Izraelevitz | 2016-11-07 20:04:19 -0500 |
|---|---|---|
| committer | GitHub | 2016-11-07 20:04:19 -0500 |
| commit | 1052a92a44b738303636fd8776597d1ea1b84a51 (patch) | |
| tree | 96eca9a00bf3031d74bb3fafd751b712114b0aee /src/main/scala/firrtl/Annotations.scala | |
| parent | 907a2b2bff7023316a29e129aa9cbc04ba794c06 (diff) | |
Fix annotations (#366)
getMyAnnotations now returns Seq[Annotation]
Changed test to check number of annotations is the same
Diffstat (limited to 'src/main/scala/firrtl/Annotations.scala')
| -rw-r--r-- | src/main/scala/firrtl/Annotations.scala | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/main/scala/firrtl/Annotations.scala b/src/main/scala/firrtl/Annotations.scala index a8aecfc5..b502e055 100644 --- a/src/main/scala/firrtl/Annotations.scala +++ b/src/main/scala/firrtl/Annotations.scala @@ -232,23 +232,8 @@ object Annotations { * Container of all annotations for a Firrtl compiler. */ case class AnnotationMap(annotations: Seq[Annotation]) { - type NamedMap = Map[Named, Map[Class[_], Annotation]] - type IDMap = Map[Class[_], Map[Named, Annotation]] - - val (namedMap: NamedMap, idMap:IDMap) = - //annotations.foldLeft(Tuple2[NamedMap, IDMap](Map.empty, Map.empty)){ - annotations.foldLeft((Map.empty: NamedMap, Map.empty: IDMap)){ - (partialMaps: (NamedMap, IDMap), annotation: Annotation) => { - val transformToAnn = partialMaps._1.getOrElse(annotation.target, Map.empty) - val pNMap = partialMaps._1 + (annotation.target -> (transformToAnn + (annotation.transform -> annotation))) - - val nToAnn = partialMaps._2.getOrElse(annotation.transform, Map.empty) - val ptransformMap = partialMaps._2 + (annotation.transform -> (nToAnn + (annotation.target -> annotation))) - Tuple2(pNMap, ptransformMap) - } - } - def get(id: Class[_]): Option[Map[Named, Annotation]] = idMap.get(id) - def get(named: Named): Option[Map[Class[_], Annotation]] = namedMap.get(named) + def get(id: Class[_]): Seq[Annotation] = annotations.filter(a => a.transform == id) + def get(named: Named): Seq[Annotation] = annotations.filter(n => n == named) } } |
