diff options
Diffstat (limited to 'src/main/scala/firrtl/options/Phase.scala')
| -rw-r--r-- | src/main/scala/firrtl/options/Phase.scala | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/scala/firrtl/options/Phase.scala b/src/main/scala/firrtl/options/Phase.scala index e5aa87ec..6a27e0da 100644 --- a/src/main/scala/firrtl/options/Phase.scala +++ b/src/main/scala/firrtl/options/Phase.scala @@ -42,11 +42,14 @@ trait TransformLike[A] extends LazyLogging { */ trait DependencyAPI[A <: DependencyAPI[A]] { this: TransformLike[_] => + /** The type used to express dependencies: a class which itself has dependencies. */ + type Dependency = Class[_ <: A] + /** All transform that must run before this transform * $seqNote */ - def prerequisites: Seq[Class[A]] = Seq.empty - private[options] lazy val _prerequisites: LinkedHashSet[Class[A]] = new LinkedHashSet() ++ prerequisites.toSet + def prerequisites: Seq[Dependency] = Seq.empty + private[options] lazy val _prerequisites: LinkedHashSet[Dependency] = new LinkedHashSet() ++ prerequisites.toSet /** All transforms that must run ''after'' this transform * @@ -67,8 +70,8 @@ trait DependencyAPI[A <: DependencyAPI[A]] { this: TransformLike[_] => * @see [[firrtl.passes.CheckTypes]] for an example of an optional checking [[firrtl.Transform]] * $seqNote */ - def dependents: Seq[Class[A]] = Seq.empty - private[options] lazy val _dependents: LinkedHashSet[Class[A]] = new LinkedHashSet() ++ dependents.toSet + def dependents: Seq[Dependency] = Seq.empty + private[options] lazy val _dependents: LinkedHashSet[Dependency] = new LinkedHashSet() ++ dependents.toSet /** A function that, given a transform will return true if this transform invalidates/undos the effects of the input * transform @@ -76,14 +79,6 @@ trait DependencyAPI[A <: DependencyAPI[A]] { this: TransformLike[_] => */ def invalidates(a: A): Boolean = true - /** Helper method to return the underlying class */ - final def asClass: Class[A] = this.getClass.asInstanceOf[Class[A]] - - /** Implicit conversion that allows for terser specification of [[DependencyAPI.prerequisites prerequisites]] and - * [[DependencyAPI.dependents dependents]]. - */ - implicit def classHelper(a: Class[_ <: A]): Class[A] = a.asInstanceOf[Class[A]] - } /** A trait indicating that no invalidations occur, i.e., all previous transforms are preserved |
