diff options
| author | chick | 2020-08-14 19:47:53 -0700 |
|---|---|---|
| committer | Jack Koenig | 2020-08-14 19:47:53 -0700 |
| commit | 6fc742bfaf5ee508a34189400a1a7dbffe3f1cac (patch) | |
| tree | 2ed103ee80b0fba613c88a66af854ae9952610ce /src/main/scala/firrtl/options/phases | |
| parent | b516293f703c4de86397862fee1897aded2ae140 (diff) | |
All of src/ formatted with scalafmt
Diffstat (limited to 'src/main/scala/firrtl/options/phases')
4 files changed, 18 insertions, 16 deletions
diff --git a/src/main/scala/firrtl/options/phases/AddDefaults.scala b/src/main/scala/firrtl/options/phases/AddDefaults.scala index ab342b1e..0ef1832a 100644 --- a/src/main/scala/firrtl/options/phases/AddDefaults.scala +++ b/src/main/scala/firrtl/options/phases/AddDefaults.scala @@ -19,7 +19,7 @@ class AddDefaults extends Phase { override def invalidates(a: Phase) = false def transform(annotations: AnnotationSeq): AnnotationSeq = { - val td = annotations.collectFirst{ case a: TargetDirAnnotation => a}.isEmpty + val td = annotations.collectFirst { case a: TargetDirAnnotation => a }.isEmpty (if (td) Seq(TargetDirAnnotation()) else Seq()) ++ annotations diff --git a/src/main/scala/firrtl/options/phases/Checks.scala b/src/main/scala/firrtl/options/phases/Checks.scala index 9e671aa5..024c13a9 100644 --- a/src/main/scala/firrtl/options/phases/Checks.scala +++ b/src/main/scala/firrtl/options/phases/Checks.scala @@ -25,24 +25,27 @@ class Checks extends Phase { val td, outA = collection.mutable.ListBuffer[Annotation]() annotations.foreach { - case a: TargetDirAnnotation => td += a + case a: TargetDirAnnotation => td += a case a: OutputAnnotationFileAnnotation => outA += a case _ => } if (td.size != 1) { - val d = td.map{ case TargetDirAnnotation(x) => x } + val d = td.map { case TargetDirAnnotation(x) => x } throw new OptionsException( s"""|Exactly one target directory must be specified, but found `${d.mkString(", ")}` specified via: | - explicit target directory: -td, --target-dir, TargetDirAnnotation - | - fallback default value""".stripMargin )} + | - fallback default value""".stripMargin + ) + } if (outA.size > 1) { - val x = outA.map{ case OutputAnnotationFileAnnotation(x) => x } + val x = outA.map { case OutputAnnotationFileAnnotation(x) => x } throw new OptionsException( s"""|At most one output annotation file can be specified, but found '${x.mkString(", ")}' specified via: - | - an option or annotation: -foaf, --output-annotation-file, OutputAnnotationFileAnnotation""" - .stripMargin )} + | - an option or annotation: -foaf, --output-annotation-file, OutputAnnotationFileAnnotation""".stripMargin + ) + } annotations } diff --git a/src/main/scala/firrtl/options/phases/GetIncludes.scala b/src/main/scala/firrtl/options/phases/GetIncludes.scala index b9320585..dd08e09b 100644 --- a/src/main/scala/firrtl/options/phases/GetIncludes.scala +++ b/src/main/scala/firrtl/options/phases/GetIncludes.scala @@ -10,7 +10,7 @@ import firrtl.FileUtils import java.io.File import scala.collection.mutable -import scala.util.{Try, Failure} +import scala.util.{Failure, Try} /** Recursively expand all [[InputAnnotationFileAnnotation]]s in an [[AnnotationSeq]] */ class GetIncludes extends Phase { @@ -37,8 +37,7 @@ class GetIncludes extends Phase { * @param annos a sequence of annotations * @return the original annotation sequence with any discovered annotations added */ - private def getIncludes(includeGuard: mutable.Set[String] = mutable.Set()) - (annos: AnnotationSeq): AnnotationSeq = { + private def getIncludes(includeGuard: mutable.Set[String] = mutable.Set())(annos: AnnotationSeq): AnnotationSeq = { annos.flatMap { case a @ InputAnnotationFileAnnotation(value) => if (includeGuard.contains(value)) { diff --git a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala index 7ee385b1..53306c8a 100644 --- a/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala +++ b/src/main/scala/firrtl/options/phases/WriteOutputAnnotations.scala @@ -16,9 +16,7 @@ import scala.collection.mutable class WriteOutputAnnotations extends Phase { override def prerequisites = - Seq( Dependency[GetIncludes], - Dependency[AddDefaults], - Dependency[Checks] ) + Seq(Dependency[GetIncludes], Dependency[AddDefaults], Dependency[Checks]) override def optionalPrerequisiteOf = Seq.empty @@ -29,8 +27,10 @@ class WriteOutputAnnotations extends Phase { val sopts = Viewer[StageOptions].view(annotations) val filesWritten = mutable.HashMap.empty[String, Annotation] val serializable: AnnotationSeq = annotations.toSeq.flatMap { - case _: Unserializable => None - case a: DeletedAnnotation => if (sopts.writeDeleted) { Some(a) } else { None } + case _: Unserializable => None + case a: DeletedAnnotation => + if (sopts.writeDeleted) { Some(a) } + else { None } case a: CustomFileEmission => val filename = a.filename(annotations) val canonical = filename.getCanonicalPath() @@ -38,7 +38,7 @@ class WriteOutputAnnotations extends Phase { filesWritten.get(canonical) match { case None => val w = new BufferedWriter(new FileWriter(filename)) - a.getBytes.foreach( w.write(_) ) + a.getBytes.foreach(w.write(_)) w.close() filesWritten(canonical) = a case Some(first) => |
