Index: mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl |
diff --git a/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl |
index 5ed5f1e3917b765bb166f316e939e1f4644a563f..00022c3123a8f6c5b7c801a56c64ae0baa2b7da9 100644 |
--- a/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/dart_templates/module_definition.tmpl |
@@ -6,22 +6,62 @@ const {{constant.kind|dart_type}} {{constant|name}} = {{constant.resolved_value} |
{#--- Enums #} |
{%- from "enum_definition.tmpl" import enum_def %} |
{%- for enum in enums %} |
-{{ enum_def(enum) }} |
+{{ enum_def(enum, typepkg, package) }} |
{%- endfor %} |
{#--- Struct definitions #} |
{%- from "struct_definition.tmpl" import struct_def %} |
{% for struct in structs %} |
-{{ struct_def(struct) }} |
+{{ struct_def(struct, typepkg, package) }} |
{%- endfor -%} |
{#--- Union definitions #} |
{%- from "union_definition.tmpl" import union_def %} |
{% for union in unions %} |
-{{ union_def(union) }} |
+{{ union_def(union, typepkg, package) }} |
{%- endfor -%} |
{#--- Interface definitions #} |
+{% import "mojom_type_macros.tmpl" as mojom_type_macros %} |
{%- for interface in interfaces -%} |
{%- include "interface_definition.tmpl" %} |
{%- endfor %} |
+ |
zra
2016/01/27 18:15:12
Newline problems might be coming from here and bel
alexfandrianto
2016/01/28 03:45:13
Newline removed
|
+{% if should_gen_mojom_types -%} |
+ |
+{% import "mojom_reference_macros.tmpl" as mojom_reference_macros %} |
+ |
+{% set mapping = '_mojomDesc' %} |
+{% set temp_mapping = 'map' %} |
+ |
+Map<String, {{typepkg}}UserDefinedType> _initDescriptions() { |
+ var {{temp_mapping}} = new HashMap<String, {{typepkg}}UserDefinedType>(); |
+{% for enum in enums -%} |
+ {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, enum)}} |
+{% endfor -%} |
+{%- for struct in structs -%} |
+ {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, struct)}} |
+{% endfor -%} |
+{%- for union in unions -%} |
+ {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, union)}} |
+{% endfor -%} |
+{%- for interface in interfaces -%} |
+ {{mojom_reference_macros.registerType(temp_mapping, typepkg, package, interface)}} |
+{% endfor -%} |
+ |
+{%- for import in imports -%} |
+{{import.unique_name}}.getAllMojomTypeDefinitions().forEach((String s, {{typepkg}}UserDefinedType udt) { |
zra
2016/01/27 18:15:12
We could probably do something about this long lin
alexfandrianto
2016/01/28 03:45:13
Done.
|
+ {{temp_mapping}}[s] = udt; |
+}); |
+{% endfor %} |
+ return {{temp_mapping}}; |
+} |
+ |
+var {{mapping}}; |
+Map<String, {{typepkg}}UserDefinedType> getAllMojomTypeDefinitions() { |
+ if ({{mapping}} == null) { |
+ {{mapping}} = _initDescriptions(); |
+ } |
+ return {{mapping}}; |
+} |
+{%- endif %} |