def add_descendants(code_element, descendants, pk_set):
    if code_element is None:
        return

    for child in code_element.children.all():
        if child.kind.is_type and child.pk not in pk_set:
            descendants.append(child)
            pk_set.add(child.pk)
            add_descendants(child, descendants, pk_set)
dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/codebase/linker/context.py/add_descendants/original