diff options
| author | Andrew Waterman | 2015-08-31 10:28:35 -0700 |
|---|---|---|
| committer | Andrew Waterman | 2015-08-31 11:05:45 -0700 |
| commit | fb1bebfe2807cf5b1fd842b4418b91bdf1ce2296 (patch) | |
| tree | 327167aaf11f4a559f2759f3f0d9951dd9a80894 /src | |
| parent | 2354f2d04529139b64e7bc023d760ebe9311e378 (diff) | |
Refactor Namespace
No need for Option, since an empty Set can be used instead.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/Chisel/Builder.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/scala/Chisel/Builder.scala b/src/main/scala/Chisel/Builder.scala index 5d003633..6598959a 100644 --- a/src/main/scala/Chisel/Builder.scala +++ b/src/main/scala/Chisel/Builder.scala @@ -2,10 +2,9 @@ package Chisel import scala.util.DynamicVariable import scala.collection.mutable.{ArrayBuffer, HashMap} -private class Namespace(parent: Option[Namespace], kws: Option[Set[String]]) { +private class Namespace(parent: Option[Namespace], keywords: Set[String]) { private var i = 0L private val names = collection.mutable.HashSet[String]() - private val keywords = kws.getOrElse(Set()) private def rename(n: String) = { i += 1; s"${n}_${i}" } @@ -20,11 +19,11 @@ private class Namespace(parent: Option[Namespace], kws: Option[Set[String]]) { res } - def child(kws: Option[Set[String]]): Namespace = new Namespace(Some(this), kws) - def child: Namespace = new Namespace(Some(this), None) + def child(kws: Set[String]): Namespace = new Namespace(Some(this), kws) + def child: Namespace = child(Set()) } -private class FIRRTLNamespace extends Namespace(None, Some(Set("mem", "node", "wire", "reg", "inst"))) +private class FIRRTLNamespace extends Namespace(None, Set("mem", "node", "wire", "reg", "inst")) private class IdGen { private var counter = -1L |
