private void popStack(Deque<ChildNode> stack, TransformContext context) {
        ChildNode rhs = stack.pop();
        ChildNode lhs = stack.peek();

        // isDefinitelyPrimitive is expensive so only invoke it when necessary
        ExpressionNode combination;
        if (rhs.op == Operator.and && isDefinitelyPrimitive(lhs.child, context) && isDefinitelyPrimitive(rhs.child, context))
            combination = andByIfNode(lhs.child, rhs.child);
        else if (rhs.op == Operator.or && isDefinitelyPrimitive(lhs.child, context) && isDefinitelyPrimitive(rhs.child, context))
            combination = orByIfNode(lhs.child, rhs.child);
        else {
            combination = resolve(lhs, rhs);
            lhs.artificial = true;
        }
        lhs.child = combination;
    }
Transforms
       a &amp;&amp; b into if(a, b, false)
and
       a || b into if(a, true, b)
to avoid computing b if a is false and true respectively.

This may increase performance since boolean expressions are not short-circuited.

@author bratseth
config-model/src/main/java/com/yahoo/schema/expressiontransforms/BooleanExpressionTransformer.java