aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/options/phases/AddDefaults.scala
diff options
context:
space:
mode:
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