// Process directives.
for (PrintDirectiveNode directiveNode : node.getChildren()) {
// Get directive.
SoyJsSrcPrintDirective directive = soyJsSrcDirectivesMap.get(directiveNode.getName());
if (directive == null) {
throw SoySyntaxExceptionUtils.createWithNode(
"Failed to find SoyJsSrcPrintDirective with name '" + directiveNode.getName() + "'" +
" (tag " + node.toSourceString() + ")",
directiveNode);
}
// Get directive args.
List<ExprRootNode<?>> args = directiveNode.getArgs();
if (! directive.getValidArgsSizes().contains(args.size())) {
throw SoySyntaxExceptionUtils.createWithNode(
"Print directive '" + directiveNode.getName() + "' used with the wrong number of" +
" arguments (tag " + node.toSourceString() + ").",
directiveNode);
}
// Translate directive args.
List<JsExpr> argsJsExprs = Lists.newArrayListWithCapacity(args.size());
for (ExprRootNode<?> arg : args) {
argsJsExprs.add(jsExprTranslator.translateToJsExpr(arg, null, localVarTranslations));
}
// Apply directive.
jsExpr = directive.applyForJsSrc(jsExpr, argsJsExprs);
}
jsExprs.add(jsExpr);
}