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

Side by Side Diff: mojo/public/tools/bindings/generators/js_templates/enum_definition.tmpl

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed template indentation Created 6 years, 2 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 {%- macro enum_def(enum_name, enum, module) -%} 1 {%- macro enum_def(enum_name, enum) -%}
2 {{enum_name}} = {}; 2 {{enum_name}} = {};
3
4 {%- set prev_enum = 0 %} 3 {%- set prev_enum = 0 %}
5 {%- for field in enum.fields %} 4 {%- for field in enum.fields %}
6 {%- if field.value %} 5 {%- if field.value %}
7 {{enum_name}}.{{field.name}} = {{field.value|expression_to_text}}; 6 {{enum_name}}.{{field.name}} = {{field.value|expression_to_text}};
8 {%- elif loop.first %} 7 {%- elif loop.first %}
9 {{enum_name}}.{{field.name}} = 0; 8 {{enum_name}}.{{field.name}} = 0;
10 {%- else %} 9 {%- else %}
11 {{enum_name}}.{{field.name}} = {{enum_name}}.{{enum.fields[loop.index0 - 1].na me}} + 1; 10 {{enum_name}}.{{field.name}} = {{enum_name}}.{{enum.fields[loop.index0 - 1].na me}} + 1;
12 {%- endif %} 11 {%- endif %}
13 {%- endfor %} 12 {%- endfor %}
14 {%- endmacro %} 13 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698