-
Notifications
You must be signed in to change notification settings - Fork 131
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
prevent infinite traversal when passed cyclic structures #107
Conversation
What tools produce parent links like this? As far as the solution goes, I'd much prefer using a seen list to this special-casing of a property named |
@michaelficarra I know there is known keys list to find which property to access. But estraverse has issue to handle unknown keys. I use ESLint with babel-eslint parser to check my code. There has a loop when query unknown key As current method that it will map all properties on unknown key to find chilren which has |
@uni-zheng I don't think you're understanding. I believe you that nodes with self-references or circular references exist. I think the best way to account for this is keeping track of nodes that have been traversed to avoid traversing them more than once. |
@michaelficarra You're right. I updated codes. |
@uni-zheng Thanks for the contribution! |
@michaelficarra Hi, I am glad to complete this contribution. And I checked |
@uni-zheng Sure, can you open an issue on esquery? |
When traverse unlisted keys,
estraverse
will iteraction this node all properties.I think in most cases the property
parent
is used to reference parent node.So I exclude
parent
in iteraction.This issue was discovered while using
esquery
,esquery
useestraverse
directly without setfallback
.