Search in sources :

Example 1 with LocalVarNode

use of com.google.template.soy.soytree.SoyNode.LocalVarNode in project closure-templates by google.

the class EnhancedAbstractExprNodeVisitor method visitVarRefNode.

@Override
protected final T visitVarRefNode(VarRefNode node) {
    VarDefn defn = node.getDefnDecl();
    switch(defn.kind()) {
        case LOCAL_VAR:
            LocalVar local = (LocalVar) defn;
            LocalVarNode declaringNode = local.declaringNode();
            switch(declaringNode.getKind()) {
                case FOR_NONEMPTY_NODE:
                    return visitForLoopVar(node, local);
                case LET_CONTENT_NODE:
                case LET_VALUE_NODE:
                    return visitLetNodeVar(node, local);
                default:
                    throw new AssertionError("Unexpected local variable: " + local);
            }
        case PARAM:
            return visitParam(node, (TemplateParam) defn);
        case IJ_PARAM:
            return visitIjParam(node, (InjectedParam) defn);
        case UNDECLARED:
            throw new RuntimeException("undeclared params are not supported by jbcsrc");
        default:
            throw new AssertionError();
    }
}
Also used : VarDefn(com.google.template.soy.exprtree.VarDefn) LocalVar(com.google.template.soy.soytree.defn.LocalVar) LocalVarNode(com.google.template.soy.soytree.SoyNode.LocalVarNode)

Aggregations

VarDefn (com.google.template.soy.exprtree.VarDefn)1 LocalVarNode (com.google.template.soy.soytree.SoyNode.LocalVarNode)1 LocalVar (com.google.template.soy.soytree.defn.LocalVar)1