diff --git a/templates/src/parser_match_tags.c.erb b/templates/src/parser_match_tags.c.erb index 120706dc1..f77590f7f 100644 --- a/templates/src/parser_match_tags.c.erb +++ b/templates/src/parser_match_tags.c.erb @@ -11,7 +11,9 @@ bool match_tags_visitor(const AST_NODE_T* node, void* data) { switch (node->type) { <%- nodes.each do |node| -%> <%- array_fields = node.fields.select { |f| f.is_a?(Herb::Template::ArrayField) && f.name != "errors" } -%> - <%- if array_fields.any? -%> + <%- single_node_fields = node.fields.select { |f| f.is_a?(Herb::Template::NodeField) } -%> + + <%- if array_fields.any? || single_node_fields.any? -%> case <%= node.type %>: { const <%= node.struct_type %>* <%= node.human %> = (const <%= node.struct_type %>*) node; @@ -20,6 +22,11 @@ bool match_tags_visitor(const AST_NODE_T* node, void* data) { match_tags_in_node_array(<%= node.human %>-><%= field.name %>, errors); } <%- end -%> + <%- single_node_fields.each do |field| -%> + if (<%= node.human %>-><%= field.name %> != NULL) { + herb_visit_node((AST_NODE_T*) <%= node.human %>-><%= field.name %>, match_tags_visitor, errors); + } + <%- end -%> } break; <%- end -%> @@ -27,5 +34,5 @@ bool match_tags_visitor(const AST_NODE_T* node, void* data) { default: break; } - return true; + return false; }