OLD | NEW |
1 {%- macro enum_def(enum_name, enum, module) -%} | 1 {%- macro enum_def(enum_name, enum) -%} |
2 {{enum_name}} = {}; | 2 {{enum_name}} = {}; |
3 | |
4 {%- set prev_enum = 0 %} | 3 {%- set prev_enum = 0 %} |
5 {%- for field in enum.fields %} | 4 {%- for field in enum.fields %} |
6 {%- if field.value %} | 5 {%- if field.value %} |
7 {{enum_name}}.{{field.name}} = {{field.value|expression_to_text}}; | 6 {{enum_name}}.{{field.name}} = {{field.value|expression_to_text}}; |
8 {%- elif loop.first %} | 7 {%- elif loop.first %} |
9 {{enum_name}}.{{field.name}} = 0; | 8 {{enum_name}}.{{field.name}} = 0; |
10 {%- else %} | 9 {%- else %} |
11 {{enum_name}}.{{field.name}} = {{enum_name}}.{{enum.fields[loop.index0 - 1].na
me}} + 1; | 10 {{enum_name}}.{{field.name}} = {{enum_name}}.{{enum.fields[loop.index0 - 1].na
me}} + 1; |
12 {%- endif %} | 11 {%- endif %} |
13 {%- endfor %} | 12 {%- endfor %} |
14 {%- endmacro %} | 13 {%- endmacro %} |
OLD | NEW |