use of com.google.template.soy.soytree.defn.LoopVar in project closure-templates by google.
the class EvalVisitor method visitIndexFunction.
private SoyValue visitIndexFunction(FunctionNode node) {
int localVarIndex;
try {
VarRefNode dataRef = (VarRefNode) node.getChild(0);
localVarIndex = env.getIndex((LoopVar) dataRef.getDefnDecl());
} catch (Exception e) {
throw RenderException.create("Failed to evaluate function call " + node.toSourceString() + ".", e);
}
return convertResult(localVarIndex);
}
use of com.google.template.soy.soytree.defn.LoopVar in project closure-templates by google.
the class RenderVisitor method executeForeachBody.
private void executeForeachBody(ForNonemptyNode child, int i, SoyValueProvider value, int size) {
LoopVar var = child.getVar();
env.bind(var, value);
env.bindCurrentIndex(var, i);
env.bindIsLast(var, size - 1 == i);
visitChildren(child);
}
use of com.google.template.soy.soytree.defn.LoopVar in project closure-templates by google.
the class EvalVisitor method visitIsFirstFunction.
private SoyValue visitIsFirstFunction(FunctionNode node) {
int localVarIndex;
try {
VarRefNode dataRef = (VarRefNode) node.getChild(0);
localVarIndex = env.getIndex((LoopVar) dataRef.getDefnDecl());
} catch (Exception e) {
throw RenderException.create("Failed to evaluate function call " + node.toSourceString() + ".", e);
}
return convertResult(localVarIndex == 0);
}
use of com.google.template.soy.soytree.defn.LoopVar in project closure-templates by google.
the class EvalVisitor method visitIsLastFunction.
private SoyValue visitIsLastFunction(FunctionNode node) {
boolean isLast;
try {
VarRefNode dataRef = (VarRefNode) node.getChild(0);
isLast = env.isLast((LoopVar) dataRef.getDefnDecl());
} catch (Exception e) {
throw RenderException.create("Failed to evaluate function call " + node.toSourceString() + ".", e);
}
return convertResult(isLast);
}
Aggregations