diff options
| author | Schuyler Eldridge | 2019-07-16 00:18:20 -0400 |
|---|---|---|
| committer | GitHub | 2019-07-16 00:18:20 -0400 |
| commit | 071feb8e3adf21e7147fc0b1c2d08ea8ccf3a5e6 (patch) | |
| tree | d02d8c63d34993a5ee7ffbd9a85ed3ee43535b52 /src/main/scala/firrtl/options/Phase.scala | |
| parent | ab87b5a114de1f0e91a4c080d77a99524fada55b (diff) | |
| parent | 85f0840d9f15151f915770230b10049514bd0281 (diff) | |
Merge pull request #1121 from freechipsproject/dependency-api-type-fix
Change Dependency API to Class[_ <: A]
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 |
