use of com.google.template.soy.exprtree.Operator in project closure-templates by google.
the class TranslateToPyExprVisitor method visitConditionalOpNode.
@Override
protected PyExpr visitConditionalOpNode(ConditionalOpNode node) {
// Retrieve the operands.
Operator op = Operator.CONDITIONAL;
List<SyntaxElement> syntax = op.getSyntax();
List<PyExpr> operandExprs = visitChildren(node);
Operand conditionalOperand = ((Operand) syntax.get(0));
PyExpr conditionalExpr = operandExprs.get(conditionalOperand.getIndex());
Operand trueOperand = ((Operand) syntax.get(4));
PyExpr trueExpr = operandExprs.get(trueOperand.getIndex());
Operand falseOperand = ((Operand) syntax.get(8));
PyExpr falseExpr = operandExprs.get(falseOperand.getIndex());
return genTernaryConditional(conditionalExpr, trueExpr, falseExpr);
}
Aggregations