[ILibraryView / Pattern] flatten() shouldn't drop ports-only patterns if flatten_ports=True
This commit is contained in:
parent
9adfcac437
commit
b843ffb4d3
4 changed files with 38 additions and 3 deletions
|
|
@ -303,7 +303,8 @@ class ILibraryView(Mapping[str, 'Pattern'], metaclass=ABCMeta):
|
|||
target_pat = flattened[target]
|
||||
if target_pat is None:
|
||||
raise PatternError(f'Circular reference in {name} to {target}')
|
||||
if target_pat.is_empty(): # avoid some extra allocations
|
||||
ports_only = flatten_ports and bool(target_pat.ports)
|
||||
if target_pat.is_empty() and not ports_only: # avoid some extra allocations
|
||||
continue
|
||||
|
||||
for ref in pat.refs[target]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue