use of com.google.template.soy.soytree.MsgSelectNode in project closure-templates by google.
the class MsgCompiler method putSelectPartIntoMap.
private void putSelectPartIntoMap(Expression mapExpression, MsgNode originalMsg, Map<String, Statement> placeholderNameToPutStatement, SoyMsgSelectPart select) {
MsgSelectNode repSelectNode = originalMsg.getRepSelectNode(select.getSelectVarName());
if (!placeholderNameToPutStatement.containsKey(select.getSelectVarName())) {
Label reattachPoint = new Label();
Expression value = soyNodeCompiler.compileToString(repSelectNode.getExpr(), reattachPoint);
placeholderNameToPutStatement.put(select.getSelectVarName(), putToMap(mapExpression, select.getSelectVarName(), value).labelStart(reattachPoint));
}
// Recursively visit select cases
for (Case<String> caseOrDefault : select.getCases()) {
putPlaceholdersIntoMap(mapExpression, originalMsg, caseOrDefault.parts(), placeholderNameToPutStatement);
}
}
Aggregations