Search in sources :

Example 1 with BuiltinFunction

use of com.google.template.soy.shared.internal.BuiltinFunction in project closure-templates by google.

the class SoyNodeCompiler method shouldCheckBuffer.

/**
 * Returns true if the print expression should check the rendering buffer and generate a detach.
 *
 * <p>We do not generate detaches for css() and xid() builtin functions, since they are typically
 * very short.
 */
private static boolean shouldCheckBuffer(PrintNode node) {
    if (!(node.getExpr().getRoot() instanceof FunctionNode)) {
        return true;
    }
    FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
    if (!(fn.getSoyFunction() instanceof BuiltinFunction)) {
        return true;
    }
    BuiltinFunction bfn = (BuiltinFunction) fn.getSoyFunction();
    if (bfn != BuiltinFunction.XID && bfn != BuiltinFunction.CSS) {
        return true;
    }
    return false;
}
Also used : BuiltinFunction(com.google.template.soy.shared.internal.BuiltinFunction) FunctionNode(com.google.template.soy.exprtree.FunctionNode)

Aggregations

FunctionNode (com.google.template.soy.exprtree.FunctionNode)1 BuiltinFunction (com.google.template.soy.shared.internal.BuiltinFunction)1