arguments not forwarded to Mixin
Opened this issue · 2 comments
AnNeub commented
If using Mixin the parameters are not forwarded to the MixinClass.
AnNeub commented
See patch, hope it helps. It only forwards parameter if mixin (user_module) is activated.
module_utilities.tpl
< {{ c.eStructuralFeatures | map(attribute='name') | map('re_sub', '$', '=None') | join(', ') }}
---
> {{ c.eStructuralFeatures| rejectattr('derived') | map(attribute='name') | map('re_sub', '$', '=None') | join(', ') }}
> {%- if c.eSuperTypes %}, **kwargs{% endif %}
> {%- endmacro %}
>
> {%- macro generate_super_init_args(c, user_module=False) -%}
> {%- if user_module and c.eStructuralFeatures -%}
> {{ c.eStructuralFeatures| rejectattr('derived') | map(attribute='name') | map('re_sub', '(.+)', '\g<0>= \g<0>') | join(', ') }}
> {%- endif %}
> {%- if c.eSuperTypes %}{{', ' if user_module and c.eStructuralFeatures else ''}}**kwargs{% endif %}
91c99
< def __init__(self{{ generate_class_init_args(c) }}{% if c.eSuperTypes %}, **kwargs{% endif %}):
---
> def __init__(self{{ generate_class_init_args(c) }}):
97,98c105,107
< super().__init__({% if c.eSuperTypes %}**kwargs{% endif %})
< {%- for feature in c.eStructuralFeatures | reject('type', ecore.EReference) %}
---
> super().__init__({{ generate_super_init_args(c, user_module) }})
>
> {%- for feature in c.eStructuralFeatures | reject('type', ecore.EReference) | rejectattr('derived')%}
109,110c118,119
< def __init__(self{{ generate_class_init_args(c) }}, **kwargs):
< super().__init__({% if c.eSuperTypes %}**kwargs{% endif %})
---
> def __init__(self{{ generate_class_init_args(c) }}):
> super().__init__({{ generate_super_init_args(c, user_module) }})
AnNeub commented
If found some bug in the patch, i have update the pre post. Should work now.