// Recurse.
visitChildren(node);
// Can simplify if either child is constant. We assume no side-effects.
SoyData operand0 = getConstantOrNull(node.getChild(0));
SoyData operand1 = getConstantOrNull(node.getChild(1));
if (operand0 == null && operand1 == null) {
return; // cannot simplify
}
ExprNode replacementNode;
if (operand0 != null && operand1 != null) {
replacementNode = new BooleanNode(operand0.toBoolean() && operand1.toBoolean());
} else if (operand0 != null) {
replacementNode = operand0.toBoolean() ? node.getChild(1) : new BooleanNode(false);
} else /*(operand1 != null)*/ {
replacementNode = operand1.toBoolean() ? node.getChild(0) : new BooleanNode(false);
}
node.getParent().replaceChild(node, replacementNode);
}