OLD | NEW |
1 {#--- Begin #} | 1 {#--- Begin #} |
2 {%- import "encoding_macros.tmpl" as encoding_macros %} | 2 {%- import "encoding_macros.tmpl" as encoding_macros %} |
3 {%- import "mojom_type_macros.tmpl" as mojom_type_macros %} | |
4 {%- macro struct_def(struct, typepkg, package) %} | 3 {%- macro struct_def(struct, typepkg, package) %} |
5 {#--- Enums #} | 4 {#--- Enums #} |
6 {%- from "enum_definition.tmpl" import enum_def %} | 5 {%- from "enum_definition.tmpl" import enum_def %} |
7 {%- for enum in struct.enums %} | 6 {%- for enum in struct.enums %} |
8 {{enum_def(enum, typepkg, package)}} | 7 {{enum_def(enum, typepkg, package)}} |
9 {%- endfor %} | 8 {%- endfor %} |
10 | 9 |
11 class {{struct|name}} extends bindings.Struct { | 10 class {{struct|name}} extends bindings.Struct { |
12 static const List<bindings.StructDataHeader> kVersions = const [ | 11 static const List<bindings.StructDataHeader> kVersions = const [ |
13 {%- for version in struct.versions %} | 12 {%- for version in struct.versions %} |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 map["{{packed_field.field|name}}"] = {{packed_field.field|name}}; | 103 map["{{packed_field.field|name}}"] = {{packed_field.field|name}}; |
105 {%- endfor %} | 104 {%- endfor %} |
106 return map; | 105 return map; |
107 {%- else %} | 106 {%- else %} |
108 throw new bindings.MojoCodecError( | 107 throw new bindings.MojoCodecError( |
109 'Object containing handles cannot be encoded to JSON.'); | 108 'Object containing handles cannot be encoded to JSON.'); |
110 {%- endif %} | 109 {%- endif %} |
111 } | 110 } |
112 } | 111 } |
113 | 112 |
114 {% if should_gen_mojom_types -%} | |
115 {{ mojom_type_macros.writeMojomTypeDef(struct, typepkg, package) }} | |
116 {%- endif -%} | |
117 {%- endmacro %} | 113 {%- endmacro %} |
OLD | NEW |