0

Right now, we have code that translates from one AST tree to their own tree. I would prefer to get rid of this second tree(it is hard enough to understand one tree, let alone two when you join a project as trees are complex as it is). One of the reasons for this is stuff was looked up on the tree walk.

I am wondering instead if during the tree walk, I could somehow add state to CommonTree that has the lookup information?

What I would like to see is something like this

CommonTree tree = parent.getChildren().get(0);
tree.setState(myMapOrObjectState);

This allows me to attach state to some nodes where it is needed before I pass to plugins. Right now, I have this ugly recreate the whole tree and wrrap the AST tree :(.

thanks, Dean

4

0 回答 0