esprima-python
esprima-python copied to clipboard
Example in example folder doesnt work. no "generic_transform" function
literal copy of transform_Object function into generic _transform function.
Since I never completed CompSci algo and data structures this may not be the right implementation but you have no issues tab to discuss further and it worked in my limited testing
Are you able to change specific nodes using this method? Because for me it is changing all similar nodes to the same value.
I dont rememeber. Though i think that was the case [that it affected every node] as looking at some of my current code that i can see from here. I ended up using the visit_node and then made calls to some additional functions i created to match what i need from the nodes and actionate if it does match.
So were you able to use the transform_Object
function? Or did you use the visit_node
function too to change the specific node within the tree? Also was it visit_generic
because there isn't a function called visit_node.
No esprima based "transform" calls used. Made my own functions to verify and change what i needed and called out to them once they weree visited.
Also no it wasnt a function literally called visit_node
. It it moreso visit_<node>
. As in you replace the "node" portion with the Javascript node type you want the AST visitor to be concerned with as it visits the tree
So you were able to transform, change or modify a specific node within your ast tree using the function you made?
I had specific matches needed in my filters. So It was more than one node....but essentially yes if they matched my filter I could change it. Cheers
How did you change it using the visit_node functions because I am having trouble changing the nodes that I want to change?