OLD | NEW |
1 {%- macro encode(variable, kind, offset, bit, level=0, check_for_null=True) %} | 1 {%- macro encode(variable, kind, offset, bit, level=0, check_for_null=True) %} |
2 {%- if kind|is_pointer_array_kind %} | 2 {%- if kind|is_pointer_array_kind or kind|is_enum_array_kind %} |
3 {%- set sub_kind = kind.kind %} | 3 {%- set sub_kind = kind.kind %} |
4 {%- set sub_kind_size = "bindings.kPointerSize" %} | 4 {%- set sub_kind_size = "bindings.kPointerSize" %} |
5 {%- if sub_kind|is_union_kind %} | 5 {%- if sub_kind|is_union_kind %} |
6 {%- set sub_kind_size = "bindings.kUnionSize" %} | 6 {%- set sub_kind_size = "bindings.kUnionSize" %} |
7 {%- elif sub_kind|is_enum_kind %} | 7 {%- elif sub_kind|is_enum_kind %} |
8 {%- set sub_kind_size = "bindings.kEnumSize" %} | 8 {%- set sub_kind_size = "bindings.kEnumSize" %} |
9 {%- endif %} | 9 {%- endif %} |
10 {%- if check_for_null -%} | 10 {%- if check_for_null -%} |
11 if ({{variable}} == null) { | 11 if ({{variable}} == null) { |
12 encoder{{level}}.encodeNullPointer({{offset}}, {{kind|is_nullable_kind|dart_tr
ue_false}}); | 12 encoder{{level}}.encodeNullPointer({{offset}}, {{kind|is_nullable_kind|dart_tr
ue_false}}); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 {%- if not kind|is_nullable_kind %} | 92 {%- if not kind|is_nullable_kind %} |
93 if ({{variable}} == null) { | 93 if ({{variable}} == null) { |
94 throw new bindings.MojoCodecError( | 94 throw new bindings.MojoCodecError( |
95 'Trying to decode null union for non-nullable {{kind|dart_type}}.'); | 95 'Trying to decode null union for non-nullable {{kind|dart_type}}.'); |
96 } | 96 } |
97 {% endif %} | 97 {% endif %} |
98 {%- else %} | 98 {%- else %} |
99 {{variable}} = decoder{{level}}.{{kind|decode_method(offset, bit)}}; | 99 {{variable}} = decoder{{level}}.{{kind|decode_method(offset, bit)}}; |
100 {%- endif %} | 100 {%- endif %} |
101 {%- endmacro %} | 101 {%- endmacro %} |
OLD | NEW |