From e98f8efcc4feb1c7a630bd2657f1a902216e6c40 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Thu, 27 Sep 2018 12:41:09 -0400 Subject: Add cloneUnderlying method to Namespace This adds a method, cloneUnderlying, to Namespace that returns a copy of the underlying mutable.HashSet. This is useful for constructing a Namespace that you would like to manipulate manually without using Namespace's methods to generate temporaries. Signed-off-by: Schuyler Eldridge --- src/main/scala/firrtl/Namespace.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/main/scala/firrtl/Namespace.scala b/src/main/scala/firrtl/Namespace.scala index f40748c2..cc5d8967 100644 --- a/src/main/scala/firrtl/Namespace.scala +++ b/src/main/scala/firrtl/Namespace.scala @@ -39,6 +39,11 @@ class Namespace private { } def newTemp: String = newName(tempNamePrefix) + + /** Create a copy of the [[scala.collection.mutable.HashSet HashSet]] backing this [[Namespace]] + * @return a copy of the underlying [[scala.collection.mutable.HashSet HashSet]] + */ + def cloneUnderlying: mutable.HashSet[String] = namespace.clone } /* TODO(azidar): Make Namespace return unique names that will not conflict with expanded -- cgit v1.2.3