From 5f9d155d1f5e2c2fb3c8b6f6309afc003196f019 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 14 Nov 2024 20:56:38 +0300 Subject: [PATCH] A bit tuning Dispose --- tpl/bhl_bind_macro.twig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tpl/bhl_bind_macro.twig b/tpl/bhl_bind_macro.twig index 59c10eb..2e8e87b 100644 --- a/tpl/bhl_bind_macro.twig +++ b/tpl/bhl_bind_macro.twig @@ -363,25 +363,23 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack {%- for arg in o.args -%} {% if arg.type is instanceof('\\mtgArrType') %} {% if arg.type.value.name == 'any' %} - { - {{arg_prefix}}{{arg.name}}?.Release(); - {{arg_prefix}}{{arg.name}} = null; - } + {{arg_prefix}}{{arg.name}}?.Release(); + {{arg_prefix}}{{arg.name}} = default; {% else %} { if({{arg_prefix}}{{arg.name}} is IDisposable dsp) - { dsp.Dispose(); - {{arg_prefix}}{{arg.name}} = default; - } + {{arg_prefix}}{{arg.name}} = default; } {% endif %} {% endif %} {% if arg.type.name == 'any' %} - {{arg_prefix}}{{arg.name}}?.Release(); + {{arg_prefix}}{{arg.name}}?.Release(); + {{arg_prefix}}{{arg.name}} = default; {% endif %} + {%- endfor ~%} {%- endmacro -%}