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

Side by Side Diff: mojo/public/tools/bindings/generators/dart_templates/union_definition.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
1 {#--- Begin #} 1 {#--- Begin #}
2 2
3 {%- import "encoding_macros.tmpl" as encoding_macros %} 3 {%- import "encoding_macros.tmpl" as encoding_macros %}
4 4 {%- import "mojom_type_macros.tmpl" as mojom_type_macros %}
5 {%- macro enum_def(union) %} 5 {%- macro enum_def(union) %}
6 enum {{union|name}}Tag { 6 enum {{union|name}}Tag {
7 {%- for field in union.fields %} 7 {%- for field in union.fields %}
8 {{field|name}}, 8 {{field|name}},
9 {%- endfor %} 9 {%- endfor %}
10 unknown 10 unknown
11 } 11 }
12 {%- endmacro %} 12 {%- endmacro %}
13 13
14 {%- macro wrapper_def(union) %} 14 {%- macro wrapper_def(union) %}
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 default: 101 default:
102 result += "unknown"; 102 result += "unknown";
103 } 103 }
104 result += ": $_data)"; 104 result += ": $_data)";
105 return result; 105 return result;
106 } 106 }
107 } 107 }
108 {%- endmacro %} 108 {%- endmacro %}
109 109
110 110
111 {%- macro union_def(union) %} 111 {%- macro union_def(union, typepkg, package) %}
112 {{enum_def(union)}} 112 {{enum_def(union)}}
113 {{wrapper_def(union)}} 113 {{wrapper_def(union)}}
114
115 {% if should_gen_mojom_types -%}
116 {{ mojom_type_macros.writeMojomTypeDef(union, typepkg, package) }}
117 {%- endif -%}
114 {%- endmacro %} 118 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698