From d0df923c43ce0b245a9d45265708846a9a204c71 Mon Sep 17 00:00:00 2001 From: "a.chubar" Date: Fri, 13 Oct 2023 18:17:34 +0400 Subject: [PATCH] Fixed more than one collection of the same type causing compiler errors --- tpl/macro.twig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index e0cbce8..04560bd 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -1,4 +1,3 @@ - {% macro decl_units(meta) %} {%- for u in meta.getunits ~%} @@ -17,7 +16,7 @@ {% endmacro %} -{% macro decl_struct(o, extra = '') %} +{% macro decl_struct(o, allow_diffs = true, extra = '') %} {% set pkey_fields = token(o, 'table_pkey')|split(',') %} {% set pkey = o.fields|filter(f => f.name in pkey_fields ) %} @@ -111,7 +110,7 @@ public {{_self.struct_type(o)}} {{o.name}} {{_self.base_struct_class(o)}} } {%- endif -%} -{%- if has_token(o, 'diffable') ~%} +{%- if has_token(o, 'diffable') and allow_diffs ~%} {{_self.diffable_support(o)}} {%- endif -%} @@ -378,8 +377,12 @@ public class {{o.name}} : IRpc return !no_changes; } + {% set unique_diff_units = [] %} {% for u in get_diff_related_units(o) %} - {{_self.diff_methods_for(u)}} + {% if u not in unique_diff_units %} + {{_self.diff_methods_for(u)}} + {% set unique_diff_units = unique_diff_units|merge([u]) %} + {% endif %} {% endfor %} {% endmacro %}