Implement tree.leaves on tree.filter.