Skip to content

Visitor does not support enter and leave for the root node #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dminkovsky opened this issue Feb 20, 2016 · 1 comment
Closed

Visitor does not support enter and leave for the root node #299

dminkovsky opened this issue Feb 20, 2016 · 1 comment

Comments

@dminkovsky
Copy link
Contributor

Hi,

I encountered a problem with Visitor.visit() today. It does not support using both enter and leave on the root node. Here is a pull request that demonstrates the problem: #298. If I understand the problem correctly, this only happens to the root node because the isLeaving() tree that processes edits is never hit upon the final exit from the root node.

The visitor is a complex bunch of procedural code. Not sure how to proceed.

@dminkovsky
Copy link
Contributor Author

So, I added a proposed fix.

It seems like this check exists exclusively for cases where the root node is edited, and if that's the case, then this fix might actually be correct. The 0th edit is the edit returned from enter and the 1st edit is the edit returned from leave. I used edits.length instead of 1, though.

Also, my added tests are up top just for ease of access. Can move them anywhere, or consolidate them into one test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant