protected List<Node> splitAssignments(Node node){
  if (node instanceof AssignmentNode) {
    List<Node> result=new ArrayList<>();
    AssignmentNode a=(AssignmentNode)node;
    result.add(a.getTarget());
    result.addAll(splitAssignments(a.getExpression()));
    return result;
  }
 else {
    return Collections.singletonList(node);
  }
}

protected List < Node > splitAssignments ( Node node ) { if ( node instanceof AssignmentNode ) { List < Node > result = new ArrayList < > ( ) ; AssignmentNode a = ( AssignmentNode ) node ; result . add ( a . getTarget ( ) ) ; result . addAll ( splitAssignments ( a . getExpression ( ) ) ) ; return result ; } else { return Collections . singletonList ( node ) ; } }
takes a node , and either returns the node itself again ( as a singleton list ) , or if the node is an assignment node , returns the lhs and rhs ( where splitassignments is applied recursively to the rhs ) .
