if (index == expression.childrenSize()) {
index--;
}
// Now traverse the child
Expression child = expression.getChild(index);
child.accept(this);
// Rather than marking the CollectionExpression as the Expression to visit
// with the adjusted QueryPosition, the child that to the left of the invalid
// expression will be used instead.
// Example: "SELECT e FROM Employee e WHERE CONCAT(e.name, A|S a)" <- | is the cursor
// In this example, "CONCAT(e.name, AS a)" is wrapped with a BadExpression, but
// "CONCAT(e.name, " is actually valid so this will allow the new QueryPosition
// to be "inside" the CONCAT expression and the proposals will be available
if (index > 0) {
Expression previousChild = expression.getChild(index - 1);
if (!isComplete(previousChild)) {
queryPosition.setExpression(previousChild);
queryPosition.addPosition(previousChild, previousChild.getLength());
}
}
if (queryPosition.getExpression() == null) {
queryPosition.setExpression(expression);