Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: mojo/public/tools/bindings/generators/dart_templates/mojom_reference_macros.tmpl

Issue 1433183002: Generate Mojom Types for Dart (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Simplify identifier_store for Go and Dart Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 {%- macro registerType(mapping, typepkg, pkg, type) -%}
6 {%- if type|identifier|identifier_check -%}{# Already printed out #}
azani 2015/11/24 20:02:02 In what situation would you call registerType on t
7 {%- elif type|is_imported_kind -%} {# Don't print. That package will do it. #}
8 {%- else -%}
9 {{type|identifier|identifier_store}}
10
11 {%- if type|mojom_type_value(typepkg) != "" -%}{#- simple kind case: do nothing -#}
12 {%- elif type|is_array_kind -%}
13 {{registerType(mapping, typepkg, pkg, type.kind)}}
14 {%- elif type|is_map_kind -%}
15 {{registerType(mapping, typepkg, pkg, type.key_kind)}}
16 {{registerType(mapping, typepkg, pkg, type.value_kind)}}
17 {% elif type|is_enum_kind %}
zra 2015/11/24 17:34:44 Maybe here and below is where the extra whitespace
alexfandrianto 2015/12/18 01:53:19 Done.
18 {{mapping}}["{{type|mojom_type_identifier}}"] =
19 new {{typepkg}}UserDefinedType()
20 ..enumType = {{type|mojom_type_identifier}}();
21 {% elif type|is_struct_kind %}
22 {{mapping}}["{{type|mojom_type_identifier}}"] =
23 new {{typepkg}}UserDefinedType()
24 ..structType = {{type|mojom_type_identifier}}();
25 {% for field in type.fields %}
26 {{registerType(mapping, typepkg, pkg, field.kind)}}
27 {% endfor %}
28 {% elif type|is_union_kind %}
29 {{mapping}}["{{type|mojom_type_identifier}}"] =
30 new {{typepkg}}UserDefinedType()
31 ..unionType = {{type|mojom_type_identifier}}();
32 {% for field in type.fields %}
33 {{registerType(mapping, typepkg, pkg, field.kind)}}
34 {% endfor %}
35 {% elif type|is_interface_kind %}
36 {{mapping}}["{{type|mojom_type_identifier}}"] =
37 new {{typepkg}}UserDefinedType()
38 ..interfaceType = {{type|mojom_type_identifier}}();
39 {%- for enum in type.enums %}
40 {{ registerType(mapping, typepkg, pkg, enum) }}
41 {%- endfor %}
42 {% elif type|is_interface_request_kind -%} {# No need to register anything #}
43 {%- else -%}
44 ERROR: UNSUPPORTED TYPE
zra 2015/11/24 17:34:44 Should this case cause bindings generation to fail
alexfandrianto 2015/12/18 01:53:19 Changed enough such that it doesn't need to error.
45 {{type|identifier}}
46 {%- endif -%}
47 {%- endif -%}
48 {%- endmacro -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698