| OLD | NEW |
| 1 {#--- Begin #} | 1 {#--- Begin #} |
| 2 | 2 |
| 3 {%- import "encoding_macros.tmpl" as encoding_macros %} | 3 {%- import "encoding_macros.tmpl" as encoding_macros %} |
| 4 {% import "mojom_type_macros.tmpl" as mojom_type_macros %} |
| 4 | 5 |
| 5 {%- macro struct_def(struct) %} | 6 {%- macro struct_def(struct, typepkg, package) %} |
| 6 {#--- Enums #} | 7 {#--- Enums #} |
| 7 {%- from "enum_definition.tmpl" import enum_def %} | 8 {%- from "enum_definition.tmpl" import enum_def %} |
| 8 {%- for enum in struct.enums %} | 9 {%- for enum in struct.enums %} |
| 9 {{enum_def(enum)}} | 10 {{enum_def(enum, typepkg, package)}} |
| 10 {%- endfor %} | 11 {%- endfor %} |
| 11 | 12 |
| 12 class {{struct|name}} extends bindings.Struct { | 13 class {{struct|name}} extends bindings.Struct { |
| 13 static const List<bindings.StructDataHeader> kVersions = const [ | 14 static const List<bindings.StructDataHeader> kVersions = const [ |
| 14 {%- for version in struct.versions %} | 15 {%- for version in struct.versions %} |
| 15 const bindings.StructDataHeader({{version.num_bytes}}, {{version.version}}){
% if not loop.last %},{% endif %} | 16 const bindings.StructDataHeader({{version.num_bytes}}, {{version.version}}){
% if not loop.last %},{% endif %} |
| 16 {%- endfor %} | 17 {%- endfor %} |
| 17 ]; | 18 ]; |
| 18 | 19 |
| 19 {#--- Constants #} | 20 {#--- Constants #} |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 {%- for packed_field in struct.packed.packed_fields %} | 99 {%- for packed_field in struct.packed.packed_fields %} |
| 99 map["{{packed_field.field|name}}"] = {{packed_field.field|name}}; | 100 map["{{packed_field.field|name}}"] = {{packed_field.field|name}}; |
| 100 {%- endfor %} | 101 {%- endfor %} |
| 101 return map; | 102 return map; |
| 102 {%- else %} | 103 {%- else %} |
| 103 throw new bindings.MojoCodecError( | 104 throw new bindings.MojoCodecError( |
| 104 'Object containing handles cannot be encoded to JSON.'); | 105 'Object containing handles cannot be encoded to JSON.'); |
| 105 {%- endif %} | 106 {%- endif %} |
| 106 } | 107 } |
| 107 } | 108 } |
| 109 |
| 110 {{ mojom_type_macros.writeMojomTypeDef(struct, typepkg, package) }} |
| 108 {%- endmacro %} | 111 {%- endmacro %} |
| OLD | NEW |