Allow Pattern.ref() to take an Abstract
This commit is contained in:
parent
c53057e5f6
commit
9d5177ce63
@ -681,7 +681,7 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
|||||||
"""
|
"""
|
||||||
return bool(self.ports)
|
return bool(self.ports)
|
||||||
|
|
||||||
def ref(self, target: str | None, *args: Any, **kwargs: Any) -> Self:
|
def ref(self, target: str | Abstract | None, *args: Any, **kwargs: Any) -> Self:
|
||||||
"""
|
"""
|
||||||
Convenience function which constructs a `Ref` object and adds it
|
Convenience function which constructs a `Ref` object and adds it
|
||||||
to this pattern.
|
to this pattern.
|
||||||
@ -694,6 +694,8 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
|||||||
Returns:
|
Returns:
|
||||||
self
|
self
|
||||||
"""
|
"""
|
||||||
|
if isinstance(target, Abstract):
|
||||||
|
target = target.name
|
||||||
self.refs[target].append(Ref(*args, **kwargs))
|
self.refs[target].append(Ref(*args, **kwargs))
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user