Automatically catch AbortRequest at n-th parent
adiba opened this issue · comments
I am replacing a parent node and then visiting the new one explicitly. In order to not visit all children twice, I have to call this.abort();
.
Catching the exception however is a bit cumbersome as I'd have to surround many traverse
calls in the visit...
methods of my visitor object with try-catch clauses and re-throw the exception if applicable.
Could you implement this in PathVisitor? I was thinking of something like this:
// jump up 2 levels
var abortLevels = 2;
this.abort(abortLevels);
The abort request should then automatically be canceled after stepping up n levels.
abortLevels = 0;
would equivalent to return false;
in this case.
What if you provided the parent type name, and it's an error if a parent of that type is not found?