// Traverse the list to (a) record whether we saw any directive that cancels autoescape
// (including 'noAutoescape' of course) and (b) remove 'noAutoescape' directives.
boolean shouldCancelAutoescape = false;
for (PrintDirectiveNode directiveNode : Lists.newArrayList(node.getChildren()) /*copy*/) {
SoyPrintDirective directive = soyDirectivesMap.get(directiveNode.getName());
if (directive == null) {
throw SoySyntaxExceptionUtils.createWithNode(
"Failed to find SoyPrintDirective with name '" + directiveNode.getName() + "'" +
" (tag " + node.toSourceString() + ")",
directiveNode);
}
if (directive.shouldCancelAutoescape()) {
shouldCancelAutoescape = true;
if (!currTemplateShouldAutoescape && directive instanceof NoAutoescapeDirective) {
// Remove reundant noAutoescape in autoescape="false" templates; however, keep it for
// other templates. This ensures filterNoAutoescape gets called for all (even
// non-contextually) autoescaped templates, as a safeguard against tainted