visitFor method

  1. @override
dynamic visitFor(
  1. ForStatement node
)

Implementation

@override
visitFor(ForStatement node) {
  if (node.init != null) {
    node.init!.visitBy(this);
  }
  while (node.condition != null && getValueFromNode(node.condition!)) {
    try {
      node.body.visitBy(this);
    } on ControlFlowBreakException catch (e) {
      break;
    } on ControlFlowContinueException catch (e) {
      //skip as we are executing the update anyway
    }
    // Execute the update expression after each loop iteration
    // see https://github.com/EnsembleUI/ensemble/issues/1704
    if (node.update != null) {
      node.update!.visitBy(this);
    }
  }
}