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

Unified Diff: mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl

Issue 674383002: Initial work on Dart bindings for Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge. Work on templates. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..ad5f3408d78d3ae284a1dd7cbe65fd35f06afc41
--- /dev/null
+++ b/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
@@ -0,0 +1,12 @@
+{%- macro enum_def(prefix, enum) -%}
+{%- set prev_enum = 0 %}
+{%- for field in enum.fields %}
+{%- if field.value %}
+{{prefix}}const int {{enum.name}}_{{field.name}} = {{field.value|expression_to_text}};
+{%- elif loop.first %}
+{{prefix}}const int {{enum.name}}_{{field.name}} = 0;
+{%- else %}
+{{prefix}}const int {{enum.name}}_{{field.name}} = {{enum.fields[loop.index0 - 1].name}} + 1;
+{%- endif %}
+{%- endfor %}
+{%- endmacro %}
« no previous file with comments | « mojo/public/mojo.gni ('k') | mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698