Tree traversal with ES6 generator