esrecurse icon indicating copy to clipboard operation
esrecurse copied to clipboard

Traverse generic nodes

Open dy opened this issue 11 years ago • 2 comments

Is there a sense to add generic nodes to traversing, such as Expression, Function, Node, Statement, Declaration, Pattern?

That is done in ast-types, and that feature seems to be quite useful.

For example:

visit(ast, {
  //walk into any node
  Node: function(node){
  }
});

Just an idea.

dy avatar Feb 18 '15 05:02 dy

That sounds very nice. I'm now planning to generate estraverse and esrecurse node shape spec from estree automatically. That has category information (such as, Node, Statement etc.) So after that, based on this category, we can implement your suggestion :)

Constellation avatar Feb 20 '15 13:02 Constellation

:+1:

Would also like to have a OtherNode property to handle any other node than those already managed.

nfroidure avatar Apr 05 '16 13:04 nfroidure