only add new_children (marginally faster)

This commit is contained in:
Jan Petykiewicz 2020-07-12 03:50:32 -07:00
parent a4b5776208
commit 89bd1e6abe

View File

@ -915,7 +915,7 @@ class Pattern:
def get_children(pat: Pattern, memo: Set) -> Set:
children = set(sp.pattern for sp in pat.subpatterns if sp.pattern is not None)
new_children = children - memo
memo |= children
memo |= new_children
for child_pat in new_children:
memo |= get_children(child_pat, memo)