pkuzqh / Recoder

MIT License
52 stars 11 forks source link

Issue with getNodeId #19

Open thanhlecongg opened 1 year ago

thanhlecongg commented 1 year ago

Hi,

I found that when you identify the root node in this line, you have ignored IfStatement and ForStatement. I guess your purpose is to traverse its children. But, how about other statements which also have children? For example, WhileStatement or BlockStatement also has children.

Particularly, I observed several cases in which the root node is BlockStatement. In such cases, your implementation returns the BlockStatement as the root node. As a result, the sub root in this line cannot be found as BlockStatement do not belong to linenode, making Recorder produce nothing.

This problem can be addressed by adding the condition of root.name != 'BlockStatement' to this line but I am not sure if it is in your intention or not. Thanks