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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl

Issue 268363003: Mojo: Add support for constants to the IDL compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JS export constants Created 6 years, 7 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/cpp_templates/module.cc.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
index 4e423aa8448506936c3602d687030926939f0769..f84ece2b403ebbd25d45a67f4d77a4a18b1dedbb 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -15,6 +15,12 @@
{%- for namespace in namespaces_as_array %}
namespace {{namespace}} {
{%- endfor %}
+
+{#--- Constants #}
+{% for constant in module.constants %}
+const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant.value|expression_to_text(module)}};
+{%- endfor %}
+
namespace internal {
namespace {
@@ -50,6 +56,13 @@ const uint32_t {{method_name}} = {{method.ordinal}};
} // namespace internal
+{#--- Struct Constants #}
+{%- for struct in structs %}
+{% for constant in struct.constants %}
+const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{constant.value|expression_to_text(module)}};
+{%- endfor %}
+{%- endfor %}
+
{#--- Struct builder definitions #}
{%- for struct in structs %}
{%- include "struct_builder_definition.tmpl" %}

Powered by Google App Engine
This is Rietveld 408576698