Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Remove toNamed (and friends) deprecation. (#1449)
Browse files Browse the repository at this point in the history
* Remove toNamed (and friends) deprecation.

* Add inadvertently deleted leading double quote.

* Remove commented out deprecations.
  • Loading branch information
ucbjrl authored Mar 23, 2020
1 parent 5658865 commit 5efcde9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
20 changes: 0 additions & 20 deletions src/main/scala/firrtl/RenameMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import firrtl.annotations.TargetToken.{Field, Index, Instance, OfModule}
import scala.collection.mutable

object RenameMap {
@deprecated("Use create with CompleteTarget instead, this will be removed in 1.3", "1.2")
def apply(map: collection.Map[Named, Seq[Named]]): RenameMap = {
val rm = new RenameMap
rm.addMap(map)
Expand Down Expand Up @@ -138,7 +137,6 @@ final class RenameMap private (val underlying: mutable.HashMap[CompleteTarget, S
* @param renameMap
* @return
*/
@deprecated("will be removed in 1.3", "1.2")
def ++ (renameMap: RenameMap): RenameMap = {
val newChained = if (chained.nonEmpty && renameMap.chained.nonEmpty) {
Some(chained.get ++ renameMap.chained.get)
Expand Down Expand Up @@ -511,47 +509,35 @@ final class RenameMap private (val underlying: mutable.HashMap[CompleteTarget, S

/* DEPRECATED ACCESSOR/SETTOR METHODS WITH [[firrtl.ir.Named Named]] */

@deprecated("Use record with CircuitTarget instead, this will be removed in 1.3", "1.2")
def rename(from: Named, to: Named): Unit = rename(from, Seq(to))

@deprecated("Use record with IsMember instead, this will be removed in 1.3", "1.2")
def rename(from: Named, tos: Seq[Named]): Unit = recordAll(Map(from.toTarget -> tos.map(_.toTarget)))

@deprecated("Use record with IsMember instead, this will be removed in 1.3", "1.2")
def rename(from: ComponentName, to: ComponentName): Unit = record(from, to)

@deprecated("Use record with IsMember instead, this will be removed in 1.3", "1.2")
def rename(from: ComponentName, tos: Seq[ComponentName]): Unit = record(from, tos.map(_.toTarget))

@deprecated("Use delete with CircuitTarget instead, this will be removed in 1.3", "1.2")
def delete(name: CircuitName): Unit = underlying(name) = Seq.empty

@deprecated("Use delete with IsMember instead, this will be removed in 1.3", "1.2")
def delete(name: ModuleName): Unit = underlying(name) = Seq.empty

@deprecated("Use delete with IsMember instead, this will be removed in 1.3", "1.2")
def delete(name: ComponentName): Unit = underlying(name) = Seq.empty

@deprecated("Use recordAll with CompleteTarget instead, this will be removed in 1.3", "1.2")
def addMap(map: collection.Map[Named, Seq[Named]]): Unit =
recordAll(map.map { case (key, values) => (Target.convertNamed2Target(key), values.map(Target.convertNamed2Target)) })

@deprecated("Use get with CircuitTarget instead, this will be removed in 1.3", "1.2")
def get(key: CircuitName): Option[Seq[CircuitName]] = {
get(Target.convertCircuitName2CircuitTarget(key)).map(_.collect{ case c: CircuitTarget => c.toNamed })
}

@deprecated("Use get with IsMember instead, this will be removed in 1.3", "1.2")
def get(key: ModuleName): Option[Seq[ModuleName]] = {
get(Target.convertModuleName2ModuleTarget(key)).map(_.collect{ case m: ModuleTarget => m.toNamed })
}

@deprecated("Use get with IsMember instead, this will be removed in 1.3", "1.2")
def get(key: ComponentName): Option[Seq[ComponentName]] = {
get(Target.convertComponentName2ReferenceTarget(key)).map(_.collect{ case c: IsComponent => c.toNamed })
}

@deprecated("Use get with IsMember instead, this will be removed in 1.3", "1.2")
def get(key: Named): Option[Seq[Named]] = key match {
case t: CompleteTarget => get(t)
case other => get(key.toTarget).map(_.collect{ case c: IsComponent => c.toNamed })
Expand All @@ -565,28 +551,24 @@ final class RenameMap private (val underlying: mutable.HashMap[CompleteTarget, S
/** Sets mutable state to record current module we are visiting
* @param module
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def setModule(module: String): Unit = moduleName = module

/** Sets mutable state to record current circuit we are visiting
* @param circuit
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def setCircuit(circuit: String): Unit = circuitName = circuit

/** Records how a reference maps to a new reference
* @param from
* @param to
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def rename(from: String, to: String): Unit = rename(from, Seq(to))

/** Records how a reference maps to a new reference
* The reference's root module and circuit are determined by whomever called setModule or setCircuit last
* @param from
* @param tos
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def rename(from: String, tos: Seq[String]): Unit = {
val mn = ModuleName(moduleName, CircuitName(circuitName))
val fromName = ComponentName(from, mn).toTarget
Expand All @@ -598,7 +580,6 @@ final class RenameMap private (val underlying: mutable.HashMap[CompleteTarget, S
* The reference's root module and circuit are determined by whomever called setModule or setCircuit last
* @param name
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def delete(name: String): Unit = {
Target(Some(circuitName), Some(moduleName), AnnotationUtils.toSubComponents(name)).getComplete match {
case Some(t: CircuitTarget) => delete(t)
Expand All @@ -611,6 +592,5 @@ final class RenameMap private (val underlying: mutable.HashMap[CompleteTarget, S
* The reference's root module and circuit are determined by whomever called setModule or setCircuit last
* @param names
*/
@deprecated("Use typesafe rename defs instead, this will be removed in 1.3", "1.2")
def delete(names: Seq[String]): Unit = names.foreach(delete(_))
}
5 changes: 0 additions & 5 deletions src/main/scala/firrtl/annotations/Target.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ sealed trait Target extends Named {
def toGenericTarget: GenericTarget = GenericTarget(circuitOpt, moduleOpt, tokens.toVector)

/** @return Converts this [[Target]] into either a [[CircuitName]], [[ModuleName]], or [[ComponentName]] */
@deprecated("Use Target instead, will be removed in 1.3", "1.2")
def toNamed: Named = toGenericTarget.toNamed

/** @return If legal, convert this [[Target]] into a [[CompleteTarget]] */
Expand Down Expand Up @@ -692,27 +691,23 @@ case class InstanceTarget(circuit: String,


/** Named classes associate an annotation with a component in a Firrtl circuit */
@deprecated("Use Target instead, will be removed in 1.3", "1.2")
sealed trait Named {
def serialize: String
def toTarget: CompleteTarget
}

@deprecated("Use Target instead, will be removed in 1.3", "1.2")
final case class CircuitName(name: String) extends Named {
if(!validModuleName(name)) throw AnnotationException(s"Illegal circuit name: $name")
def serialize: String = name
def toTarget: CircuitTarget = CircuitTarget(name)
}

@deprecated("Use Target instead, will be removed in 1.3", "1.2")
final case class ModuleName(name: String, circuit: CircuitName) extends Named {
if(!validModuleName(name)) throw AnnotationException(s"Illegal module name: $name")
def serialize: String = circuit.serialize + "." + name
def toTarget: ModuleTarget = ModuleTarget(circuit.name, name)
}

@deprecated("Use Target instead, will be removed in 1.3", "1.2")
final case class ComponentName(name: String, module: ModuleName) extends Named {
if(!validComponentName(name)) throw AnnotationException(s"Illegal component name: $name")
def expr: Expression = toExp(name)
Expand Down

0 comments on commit 5efcde9

Please sign in to comment.