diff options
| author | Jack Koenig | 2018-10-31 14:34:13 -0700 |
|---|---|---|
| committer | Jack Koenig | 2018-10-31 15:22:26 -0700 |
| commit | bd6065b07b2c4de8cbb127a962bbfb8507f049c3 (patch) | |
| tree | 38b0e9b152cfb42707ba231458b525c1e4f73367 /src/main | |
| parent | e687c99ba343fe2856ae047f3720195b62a49786 (diff) | |
Speed up LowerTypes by replacing foldLeft + List appends with flatMap
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/passes/LowerTypes.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/passes/LowerTypes.scala b/src/main/scala/firrtl/passes/LowerTypes.scala index 663241d3..ee03afb5 100644 --- a/src/main/scala/firrtl/passes/LowerTypes.scala +++ b/src/main/scala/firrtl/passes/LowerTypes.scala @@ -47,15 +47,15 @@ object LowerTypes extends Transform { val name = root + loweredName(e) renames.rename(root + e.serialize, name) Seq(name) - case (t: BundleType) => t.fields.foldLeft(Seq[String]()){(names, f) => + case (t: BundleType) => t.fields.flatMap { f => val subNames = renameExps(renames, WSubField(e, f.name, f.tpe, times(gender(e), f.flip)), root) renames.rename(root + e.serialize, subNames) - names ++ subNames + subNames } - case (t: VectorType) => (0 until t.size).foldLeft(Seq[String]()){(names, i) => + case (t: VectorType) => (0 until t.size).flatMap { i => val subNames = renameExps(renames, WSubIndex(e, i, t.tpe,gender(e)), root) renames.rename(root + e.serialize, subNames) - names ++ subNames + subNames } } |
