estraverse
estraverse copied to clipboard
backward traversal
First, thank you for very elegant, concise, and useful tool. I use both tools: estraverse and recently shift-traverse for my projects.
One thing that I am missing is backward AST traversal. IMHO It will be useful for the static code analysis algorithms like lazy SSA construction or definition search.
What do you think?
Hey, @drom, I see, you're in theme, but I am a novice. do you know also, are there backward AST generation algorithms?
I build AST locally backward and forward from the point on target node in large (and possibly not correct at all) source code file.
e.g.:
var c conosle.log.bind(console); // far away mistaken statement
... // about 100 sloc
foo({ bar:1, baz: 2, qux: 42 });
// ^ Starts AST-generation here for ObjectExpression
I use acorn.parseExpressionAt and some heuristics for that.