You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, node.parent is undefined while the node actually has a parent. This happens only on leaf nodes that were accessed with a cursor.
Sometimes, reading node.parent has side-effects.
void (cursor.currentNode.parent)
This statement is supposed to do nothing right? Well, if I comment it out, tree-sitter is giving me another tree! It's giving me nodes of type _expression that disappear when uncommenting the statement.
I am having this in a large codebase. I will try to make a minimal reproducible examples but I probably won't be able to do it soon. I opended this issue just wondering if this problem is known. You can close it meanwhile if you want.
Are you using web-tree-sitter or node-tree-sitter?
This issue was not known to me already. A minimal reproduction would allow me to fix it much more quickly, but I can understand how that may take time for you to set up. Thanks for the report, and apologies for the bug.
Closing this out since the bug in the core library is fixed. I'll leave tree-sitter/node-tree-sitter#61 open until a new node-tree-sitter version is published.
Activity
maxbrunsfeld commentedon Mar 4, 2020
Are you using
web-tree-sitterornode-tree-sitter?This issue was not known to me already. A minimal reproduction would allow me to fix it much more quickly, but I can understand how that may take time for you to set up. Thanks for the report, and apologies for the bug.
sguillia commentedon Mar 7, 2020
No problem, I'm already glad this project exists!
I am using node-tree-sitter. Indeed, this issue might belong more to the binding than to the grammar.
Fix incorrect parent values after call to child_by_field_name
maxbrunsfeld commentedon Apr 3, 2020
Closing this out since the bug in the core library is fixed. I'll leave tree-sitter/node-tree-sitter#61 open until a new node-tree-sitter version is published.
sguillia commentedon Apr 3, 2020
@maxbrunsfeld The bug is indeed fixed, thank you!
If you ever want an example to reproduce the implicit side-effects, before 0.16.1, here you are.
https://github.com/sguillia/tree-sitter-ub
(wish I had seen your message before)