Add ability to traverse tree in post order
Open
enhancement
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Instead of #512, there could instead be an option to traverse in post order.
For example:
```ts
enum TreeOrder {
Pre = "pre",
Post = "post"
}
node.forEachDescendant(TreeOrder.Post, (node, traversal) => {
console.log(node.getText());
});
node.getDescendantsOfKind(SyntaxKind.ClassDeclaration, TreeOrder.Post);
```
See [this comment](https://github.com/dsherret/ts-simple-ast/issues/512#issuecomment-447601251).
Also, when the tree order is pre and a "node was forgotten" error occurs, it should suggest to the user to use post order.
Contributor guide
Assessment
This issue has not been assessed yet.