// Process directives.
for (PrintDirectiveNode directiveNode : node.getChildren()) {
// Get directive.
SoyJavaSrcPrintDirective directive = soyJavaSrcDirectivesMap.get(directiveNode.getName());
if (directive == null) {
throw SoySyntaxExceptionUtils.createWithNode(
"Failed to find SoyJavaSrcPrintDirective 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<JavaExpr> argsJavaExprs = Lists.newArrayListWithCapacity(args.size());
for (ExprRootNode<?> arg : args) {
argsJavaExprs.add(ttjev.exec(arg));
}
// Apply directive.
javaExpr = directive.applyForJavaSrc(javaExpr, argsJavaExprs);
}
javaExprs.add(javaExpr);
}