in src/main/java/org/apache/sling/scripting/sightly/impl/compiler/optimization/DeadCodeRemoval.java [89:106]
public void visit(Conditional.Start conditionalStart) {
Boolean truthValue = tracker.get(conditionalStart.getVariable());
boolean keepConditionalEnd;
if (truthValue == null) { // no information about the value of this variable
keepConditionalEnd = true;
outStream.write(conditionalStart);
} else { // we already know what happens with this conditional. We can remove it
keepConditionalEnd = false;
if (truthValue != conditionalStart.getExpectedTruthValue()) {
// this conditional will always fail. We can ignore everything until
// the corresponding end-conditional
stateControl.push(
new StatefulRangeIgnore(stateControl, Conditional.Start.class, Conditional.End.class));
return;
}
}
keepConditionalEndStack.push(keepConditionalEnd);
}