Project

General

Profile

Actions

Bug #10177

open

TreeVisitor's SKIP status does not work as expected

Added by Alexander Kamkin over 4 years ago. Updated over 4 years 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.

Actions #1

Updated by Artem Kotsynyak over 4 years 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.

Actions #2

Updated by Artem Kotsynyak over 4 years 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);
  }
}

Actions #3

Updated by Alexander Kamkin over 4 years ago

IMHO, the status should be re-set automatically.

Actions

Also available in: Atom PDF