Project

General

Profile

Bug #10177

TreeVisitor's SKIP status does not work as expected

Added by Alexander Kamkin 3 months ago. Updated 3 months ago.

Status:
Feedback
Priority:
Normal
Category:
Expression
Target version:
Start date:
03/24/2020
Due date:
% Done:

0%

Estimated time:
Detected in build:
git
Platform:
Published in build:

Description

When I call setStatus(Status.SKIP) in onOperationBegin(node), I expect the visitor will not visit the node's children but will visit the node's neighbors.
However, the call skips visiting the neighbors.

History

#1

Updated by Artem Kotsynyak 3 months ago

  • Status changed from New to Feedback

Which TreeVisitor implementation behaves that way?
TreeVisitor and ExprTreeVisitor are interfaces, ExprTreeVisitorDefault is a stub that does not implement SKIP/ABORT logic.

#2

Updated by Artem Kotsynyak 3 months ago

Upon further investigation, I've found it is required to manually setStatus(Status.OK) in onOperationEnd() to continue traversal as normal, e.g.

public void onOperationEnd(NodeOperation node) {
  if (getStatus() == Status.SKIP) {
    setStatus(Status.OK);
  }
}

#3

Updated by Alexander Kamkin 3 months ago

IMHO, the status should be re-set automatically.

Also available in: Atom PDF