aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options/phases/AddDefaults.scala
diff options
context:
space:
mode:
authorJack Koenig2019-04-26 13:10:44 -0700
committerGitHub2019-04-26 13:10:44 -0700
commita7cf6ff3416a11088d811a435ba71fd36b191fb4 (patch)
tree79e2e8c5753903ca6d14e9b952c26a07442bd980 /src/main/scala/firrtl/options/phases/AddDefaults.scala
parent99ae1d6649f1731c5dec2098b10733735232b72c (diff)
parentef8f06f23b9ee6cf86de2450752dfd0fcd32da80 (diff)
Merge pull request #1005 from freechipsproject/f764.7
Stage/Phase
Diffstat (limited to 'src/main/scala/firrtl/options/phases/AddDefaults.scala')
-rw-r--r--src/main/scala/firrtl/options/phases/AddDefaults.scala8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/main/scala/firrtl/options/phases/AddDefaults.scala b/src/main/scala/firrtl/options/phases/AddDefaults.scala
index f0749b22..2d4e4e40 100644
--- a/src/main/scala/firrtl/options/phases/AddDefaults.scala
+++ b/src/main/scala/firrtl/options/phases/AddDefaults.scala
@@ -10,14 +10,10 @@ import firrtl.options.{Phase, StageOption, TargetDirAnnotation}
* This currently only adds a [[TargetDirAnnotation]]. This isn't necessary for a [[StageOptionsView]], but downstream
* tools may expect a [[TargetDirAnnotation]] to exist.
*/
-object AddDefaults extends Phase {
+class AddDefaults extends Phase {
def transform(annotations: AnnotationSeq): AnnotationSeq = {
- var td = true
- annotations.collect { case a: StageOption => a }.map {
- case _: TargetDirAnnotation => td = false
- case _ =>
- }
+ val td = annotations.collectFirst{ case a: TargetDirAnnotation => a}.isEmpty
(if (td) Seq(TargetDirAnnotation()) else Seq()) ++
annotations