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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/enum.tmpl

Issue 910883002: Update mojo sdk to rev 8af2ccff2eee4bfca1043015abee30482a030b30 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply 9f87aeadbda22441b7d469e596f7bd7d0d73e2a8 (https://codereview.chromium.org/908973002/) Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/enum.tmpl
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/enum.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/enum.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..8bc882fd2fc18bcf8be624c0dfaf95ddac248c6c
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/go_templates/enum.tmpl
@@ -0,0 +1,20 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+{% macro define(enum) %}
+type {{enum|name}} int32
+
+const (
+{% for field in enum.fields %}
+{% if field.value %}
+ {{enum|name}}_{{field|name}} = {{field.value|expression_to_text}}
+{% elif loop.first %}
+ {{enum|name}}_{{field|name}} = 0
+{% else %}
+ {{enum|name}}_{{field|name}} = {{enum|name}}_{{enum.fields[loop.index0 - 1]|name}} + 1;
+{% endif %}
+{% endfor %}
+)
+
+{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698