if (!expr) context.consumeCurrentValue();
}
}
public void compileArray(Node node, BodyCompiler context, boolean expr) {
ArrayNode arrayNode = (ArrayNode) node;
if (expr) {
ArrayCallback callback = new ArrayCallback() {
public void nextValue(BodyCompiler context, Object sourceArray, int index) {
Node node = (Node) ((Object[]) sourceArray)[index];
compile(node, context, true);
}
};
List<Node> childNodes = arrayNode.childNodes();
if (isListAllLiterals(arrayNode)) {
context.createNewLiteralArray(childNodes.toArray(), callback, arrayNode.isLightweight());
} else {
context.createNewArray(childNodes.toArray(), callback, arrayNode.isLightweight());
}
} else {
if (isListAllLiterals(arrayNode)) {
// do nothing, no observable effect
} else {
for (Iterator<Node> iter = arrayNode.childNodes().iterator(); iter.hasNext();) {
Node nextNode = iter.next();
compile(nextNode, context, false);
}
}
}