OLD | NEW |
---|---|
1 {#--- Constants #} | 1 {#--- Constants #} |
2 {%- for constant in module.constants %} | 2 {%- for constant in module.constants %} |
3 const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value} }; | 3 const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value} }; |
4 {%- endfor %} | 4 {%- endfor %} |
5 | 5 |
6 {#--- Enums #} | 6 {#--- Enums #} |
7 {%- from "enum_definition.tmpl" import enum_def %} | 7 {%- from "enum_definition.tmpl" import enum_def %} |
8 {%- for enum in enums %} | 8 {%- for enum in enums %} |
9 {{ enum_def(enum) }} | 9 {{ enum_def(enum, typepkg, package) }} |
10 {%- endfor %} | 10 {%- endfor %} |
11 | 11 |
12 {#--- Struct definitions #} | 12 {#--- Struct definitions #} |
13 {%- from "struct_definition.tmpl" import struct_def %} | 13 {%- from "struct_definition.tmpl" import struct_def %} |
14 {% for struct in structs %} | 14 {% for struct in structs %} |
15 {{ struct_def(struct) }} | 15 {{ struct_def(struct, typepkg, package) }} |
16 {%- endfor -%} | 16 {%- endfor -%} |
17 | 17 |
18 {#--- Union definitions #} | 18 {#--- Union definitions #} |
19 {%- from "union_definition.tmpl" import union_def %} | 19 {%- from "union_definition.tmpl" import union_def %} |
20 {% for union in unions %} | 20 {% for union in unions %} |
21 {{ union_def(union) }} | 21 {{ union_def(union, typepkg, package) }} |
22 {%- endfor -%} | 22 {%- endfor -%} |
23 | 23 |
24 {#--- Interface definitions #} | 24 {#--- Interface definitions #} |
25 {% import "mojom_type_macros.tmpl" as mojom_type_macros %} | |
25 {%- for interface in interfaces -%} | 26 {%- for interface in interfaces -%} |
26 {%- include "interface_definition.tmpl" %} | 27 {%- include "interface_definition.tmpl" %} |
27 {%- endfor %} | 28 {%- endfor %} |
29 | |
30 {% if should_gen_mojom_types -%} | |
31 | |
32 {% import "mojom_reference_macros.tmpl" as mojom_reference_macros %} | |
33 | |
34 {% set mapping = '_MojomDesc' %} | |
zra
2016/01/15 21:01:33
_mojomDesc
alexfandrianto
2016/01/20 00:08:28
Done.
| |
35 {% set temp_mapping = 'map' %} | |
36 | |
37 Map<String, {{typepkg}}UserDefinedType> _initDescriptions() { | |
38 var {{temp_mapping}} = new HashMap<String, {{typepkg}}UserDefinedType>(); | |
39 {% for enum in enums -%} | |
40 {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, enum)}} | |
41 {% endfor -%} | |
42 {%- for struct in structs -%} | |
43 {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, struct)} } | |
44 {% endfor -%} | |
45 {%- for union in unions -%} | |
46 {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, union)}} | |
47 {% endfor -%} | |
48 {%- for interface in interfaces -%} | |
49 {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, interfac e)}} | |
50 {% endfor -%} | |
51 | |
52 {%- for import in imports -%} | |
53 {{import.unique_name}}.getAllMojomTypeDefinitions().forEach((String s, {{typepkg }}UserDefinedType udt) { | |
54 {{temp_mapping}}[s] = udt; | |
55 }); | |
56 {% endfor %} | |
57 return {{temp_mapping}}; | |
58 } | |
59 | |
60 var {{mapping}}; | |
61 Map<String, {{typepkg}}UserDefinedType> getAllMojomTypeDefinitions() { | |
62 if ({{mapping}} == null) { | |
63 {{mapping}} = _initDescriptions(); | |
64 } | |
65 return {{mapping}}; | |
66 } | |
67 {%- endif %} | |
OLD | NEW |