Project

General

Profile

Actions

Task #5565

closed

[expression] Setting traversal order in visitor

Added by Alexander Kamkin almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrei Tatarnikov
Category:
-
Target version:
Start date:
01/20/2015
Due date:
% Done:

100%

Estimated time:
Detected in build:
svn
Published in build:
150217

Description

There should be possibility to set up order of operands traversal.

After calling onOperationBegin the walker should call the getOrder method. The result is an integer array defining the traversal order:

onOperationBegin(operation);
int[] order = getOrder();
...
for (int index = 0; index < number; index++) {
  Operand operand = node.getOperand(order != null ? order[index] : index);
  onOperandBegin(operand, index); // IMPORTANT: index (not order[index])!
  ...
}
Actions

Also available in: Atom PDF