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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 months 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|is_enum_kind -%}
7 {{mapping}}["{{type|mojom_type_identifier}}"] =
8 new {{typepkg}}UserDefinedType()
9 ..enumType = _{{type|mojom_type_identifier|lower_camel}}();
10 {%- elif type|is_struct_kind -%}
11 {{mapping}}["{{type|mojom_type_identifier}}"] =
12 new {{typepkg}}UserDefinedType()
13 ..structType = _{{type|mojom_type_identifier|lower_camel}}();
14 {%- for enum in type.enums %}
15 {{ registerType(mapping, typepkg, pkg, enum) }}
16 {%- endfor %}
17 {%- elif type|is_union_kind -%}
18 {{mapping}}["{{type|mojom_type_identifier}}"] =
19 new {{typepkg}}UserDefinedType()
20 ..unionType = _{{type|mojom_type_identifier|lower_camel}}();
21 {%- elif type|is_interface_kind -%}
22 {{mapping}}["{{type|mojom_type_identifier}}"] =
23 new {{typepkg}}UserDefinedType()
24 ..interfaceType = _{{type|mojom_type_identifier|lower_camel}}();
25 {%- for enum in type.enums %}
26 {{ registerType(mapping, typepkg, pkg, enum) }}
27 {%- endfor %}
28 {%- else -%}
29 {# Simple kinds, arrays, maps, and handles do not need to be registered. #}
30 {%- endif -%}
31 {%- endmacro -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698