Chromium Code Reviews| Index: mojo/public/tools/bindings/generators/go_templates/enum.tmpl |
| diff --git a/mojo/public/tools/bindings/generators/go_templates/enum.tmpl b/mojo/public/tools/bindings/generators/go_templates/enum.tmpl |
| index 8bc882fd2fc18bcf8be624c0dfaf95ddac248c6c..f7f29aa79513a9e8e52e1c3f56e6a68f581931e9 100644 |
| --- a/mojo/public/tools/bindings/generators/go_templates/enum.tmpl |
| +++ b/mojo/public/tools/bindings/generators/go_templates/enum.tmpl |
| @@ -2,7 +2,10 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -{% macro define(enum) %} |
| +{% import "mojom_type_macros.tmpl" as mojom_type_macros %} |
| +{% import "mojom_util_macros.tmpl" as util %} |
| + |
| +{% macro define(enum, typepkg, package) %} |
| type {{enum|name}} int32 |
| const ( |
| @@ -17,4 +20,16 @@ const ( |
| {% endfor %} |
| ) |
| +// String names and labels used by the MojomEnum types. |
| +var ( |
|
azani
2015/10/12 21:13:07
Could you create a new jinja file and put all thos
alexfandrianto
2015/10/16 21:25:49
I combined them into a macro (writeMojomTypeDef) i
|
| + enumName_{{enum|name}} = "{{enum|name}}" |
| +{% for field in enum.fields %} |
| + enumFieldName_{{enum|name}}_{{field|name}} = "{{field|name}}" |
| +{% endfor %} |
| +) |
| + |
| +func {{util.typeName(enum, typepkg, package)}}() {{typepkg}}MojomEnum { |
| + return {{ mojom_type_macros.writeMojomType(typepkg, enum, package, exported) }} |
| +} |
| + |
| {% endmacro %} |