String directiveName, SoyData value, List<SoyData> args, SoyNode node) {
// Get directive.
SoyTofuPrintDirective directive = soyTofuDirectivesMap.get(directiveName);
if (directive == null) {
throw new RenderException(
"Failed to find Soy print directive with name '" + directiveName + "'" +
" (tag " + node.toSourceString() + ")");
}
// TODO: Add a pass to check num args at compile time.
if (! directive.getValidArgsSizes().contains(args.size())) {
throw new RenderException(
"Print directive '" + directiveName + "' used with the wrong number of" +
" arguments (tag " + node.toSourceString() + ").");
}
return directive.applyForTofu(value, args);