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

Unified Diff: mojo/public/bindings/generators/js_templates/module.js.tmpl

Issue 99623010: Add support for enums within structs and interfaces to mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/bindings/generators/js_templates/module.js.tmpl
diff --git a/mojo/public/bindings/generators/js_templates/module.js.tmpl b/mojo/public/bindings/generators/js_templates/module.js.tmpl
index 7483b88181946a9a5a84c7782312129a36417301..ea0391d274fdd207cfaafbf6e8a8fa8ad0d80425 100644
--- a/mojo/public/bindings/generators/js_templates/module.js.tmpl
+++ b/mojo/public/bindings/generators/js_templates/module.js.tmpl
@@ -8,21 +8,13 @@ define([
], function(core, codec) {
{#--- Enums #}
+{%- from "enum_definition.tmpl" import enum_def -%}
{% for enum in enums %}
- var {{enum.name}} = {
-{%- set next_value = 0 %}
-{%- for field in enum.fields %}
-{%- if field.value %}
-{%- set next_value = field.value|int %}
-{%- endif %}
- {{field.name}}: {{next_value}},
-{%- set next_value = next_value + 1 %}
-{%- endfor %}
- };
-{% endfor %}
+{{ enum_def("var %s"|format(enum.name), enum) }}
+{%- endfor %}
{#--- Struct definitions #}
-{%- for struct in structs %}
+{% for struct in structs %}
{% include "struct_definition.tmpl" %}
{%- endfor %}

Powered by Google App Engine
This is Rietveld 408576698