private void propagateAcrossDisjunction(ParentSoyNode<?> node) {
try {
// All the branches of an {if} or {switch} should return compatible contexts, so that we can
// figure out the end context of the branch as a whole.
Iterator<? extends SoyNode> childIt = node.getChildren().iterator();
SoyNode firstBranch = childIt.next();
Context out = infer(firstBranch, context);
boolean sawElseOrDefault = false;
while (childIt.hasNext()) {
SoyNode branch = childIt.next();
Context brOut = infer(branch, context);
Context combined = Context.union(out, brOut);
if (combined.isErrorContext()) {
throw SoyAutoescapeException.createWithNode(
(node instanceof IfNode ?
"{if} command branch ends in a different context than preceding branches: " :
"{switch} command case ends in a different context than preceding cases: ") +
branch.toSourceString(),
branch);
}
out = combined;
if (branch instanceof IfElseNode || branch instanceof SwitchDefaultNode) {
sawElseOrDefault = true;