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

Unified Diff: mojo/public/tools/bindings/generators/go_templates/mojom_util_macros.tmpl

Issue 1345263002: Generate Mojom Types in Go (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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: mojo/public/tools/bindings/generators/go_templates/mojom_util_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/go_templates/mojom_util_macros.tmpl b/mojo/public/tools/bindings/generators/go_templates/mojom_util_macros.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..3e87f69cf356f2d2511244b67d50978c17b9d24d
--- /dev/null
+++ b/mojo/public/tools/bindings/generators/go_templates/mojom_util_macros.tmpl
@@ -0,0 +1,33 @@
+// 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 typeName(t, typepkg, pkg) -%}
+{%- if t|is_enum -%}
+{{enumName(t, typepkg, pkg)}}
+{%- elif t|is_struct -%}
+{{structName(t, typepkg, pkg)}}
+{%- elif t|is_union -%}
+{{unionName(t, typepkg, pkg)}}
+{%- elif t|is_interface -%}
+{{interfaceName(t, typepkg, pkg)}}
+{%- else -%}
+BAD TYPE NAME GIVEN
+{%- endif -%}
+{%- endmacro -%}
+
+{%- macro enumName(t, typepkg, pkg) -%}
+MojomEnum{{t|identifier(pkg)}}__
+{%- endmacro -%}
+
+{%- macro structName(t, typepkg, pkg) -%}
+MojomStruct{{t|identifier(pkg)}}__
+{%- endmacro -%}
+
+{%- macro unionName(t, typepkg, pkg) -%}
+MojomUnion{{t|identifier(pkg)}}__
+{%- endmacro -%}
+
+{%- macro interfaceName(t, typepkg, pkg) -%}
+MojomInterface{{t|identifier(pkg)}}__
+{%- endmacro -%}

Powered by Google App Engine
This is Rietveld 408576698