Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing return ordering of depth_first_traversal_by
Summary: The original is D57905416. `preorder-left-to-right` by default was backed out D58097382 due to runtime failures. Investigation showed that it was not implemented correctly. `depth_first_traversal_by` does two things: 1. Calls `get_nodes_to_traverse_func` for each node. That was called with correct `preorder-left-to-right` order as expected. 2. Returns the list of all elements that was walked throught. **We had an error here**. We can't use `visited` list for returning results. `visited` does *not* always ordered in the same way. If we have more than one `roots` passed the order was broken. Solving it by defining explicit list for return and fill it in the exact same way I do traversal. Now everything works! Reviewed By: artempyanykh Differential Revision: D58137945 fbshipit-source-id: 53aacdd3b833de48e7e91e01a2ef10fefee81252
- Loading branch information