{"action":"created","issue":{"url":"https://api.github.com/repos/nikic/PHP-Parser/issues/161","labels_url":"https://api.github.com/repos/nikic/PHP-Parser/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/nikic/PHP-Parser/issues/161/comments","events_url":"https://api.github.com/repos/nikic/PHP-Parser/issues/161/events","html_url":"https://github.com/nikic/PHP-Parser/issues/161","id":53023834,"number":161,"title":"Feature request: allow NodeVisitor to indicate to NodeTraverser no further traversal down this branch","user":{"login":"mappu","id":3959202,"avatar_url":"https://avatars.githubusercontent.com/u/3959202?v=3","gravatar_id":"","url":"https://api.github.com/users/mappu","html_url":"https://github.com/mappu","followers_url":"https://api.github.com/users/mappu/followers","following_url":"https://api.github.com/users/mappu/following{/other_user}","gists_url":"https://api.github.com/users/mappu/gists{/gist_id}","starred_url":"https://api.github.com/users/mappu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mappu/subscriptions","organizations_url":"https://api.github.com/users/mappu/orgs","repos_url":"https://api.github.com/users/mappu/repos","events_url":"https://api.github.com/users/mappu/events{/privacy}","received_events_url":"https://api.github.com/users/mappu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-29T07:09:44Z","updated_at":"2015-01-08T23:55:38Z","closed_at":null,"body":"I need to avoid doing some processing on nodes if they have certain parents somewhere further up the AST.\r\n\r\nOne way would be to recursively look up parents of a node. But this isn't possible (even if it was, it duplicates NodeTraverser in reverse and would be less efficient than simply stopping the traversal at once when meeting my stop condition). So i think it would be useful if i could prevent further tree traversal from within a `NodeVisitor`.\r\n\r\nI suggest this is implemented as\r\n- an additional possible return value from `NodeVisitor`\r\n- or alternatively, by throwing some certain `PleaseNoMoreTraversalDownThisBranch` exception from within `NodeVisitor::enterNode` caught by `NodeTraverser`."},"comment":{"url":"https://api.github.com/repos/nikic/PHP-Parser/issues/comments/69272254","html_url":"https://github.com/nikic/PHP-Parser/issues/161#issuecomment-69272254","issue_url":"https://api.github.com/repos/nikic/PHP-Parser/issues/161","id":69272254,"user":{"login":"edsonmedina","id":5449,"avatar_url":"https://avatars.githubusercontent.com/u/5449?v=3","gravatar_id":"","url":"https://api.github.com/users/edsonmedina","html_url":"https://github.com/edsonmedina","followers_url":"https://api.github.com/users/edsonmedina/followers","following_url":"https://api.github.com/users/edsonmedina/following{/other_user}","gists_url":"https://api.github.com/users/edsonmedina/gists{/gist_id}","starred_url":"https://api.github.com/users/edsonmedina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edsonmedina/subscriptions","organizations_url":"https://api.github.com/users/edsonmedina/orgs","repos_url":"https://api.github.com/users/edsonmedina/repos","events_url":"https://api.github.com/users/edsonmedina/events{/privacy}","received_events_url":"https://api.github.com/users/edsonmedina/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T23:55:38Z","updated_at":"2015-01-08T23:55:38Z","body":"+1\r\nThe only workaround I could find is having a \"mute\" variable shared between `NodeVisitors` that I set on `enterNode` and later unset in `leaveNove` of the parent node. All visitors would have to respect this mute."}}