use of org.apache.sling.scripting.sightly.compiler.expression.nodes.BooleanConstant in project sling by apache.
the class DeadCodeRemoval method visit.
@Override
public void visit(VariableBinding.Start variableBindingStart) {
Boolean truthValue = null;
ExpressionNode node = variableBindingStart.getExpression();
if (node instanceof StringConstant) {
truthValue = CompileTimeObjectModel.toBoolean(((StringConstant) node).getText());
}
if (node instanceof BooleanConstant) {
truthValue = ((BooleanConstant) node).getValue();
}
if (node instanceof NumericConstant) {
truthValue = CompileTimeObjectModel.toBoolean(((NumericConstant) node).getValue());
}
if (node instanceof NullLiteral) {
truthValue = CompileTimeObjectModel.toBoolean(null);
}
tracker.pushVariable(variableBindingStart.getVariableName(), truthValue);
outStream.write(variableBindingStart);
}
Aggregations