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

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

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/struct_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
index ebc6048c29253d881deb160df3c3e8209412c8a7..5405fa42fd5bbd38971640c096993a387a4d4459 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
@@ -111,7 +111,7 @@
{{output}}->{{name}} = mojo::internal::AssociatedInterfaceRequestHelper::PassHandle(&{{input_field}}).release();
{%- endif %}
{%- elif kind|is_enum_kind %}
- {{output}}->{{name}} = static_cast<int32_t>({{input_field}});
+ {{output}}->{{name}}.value = static_cast<int32_t>({{input_field}});
{%- else %}
{{output}}->{{name}} = {{input_field}};
{%- endif %}
@@ -181,7 +181,7 @@
&{{output_field}},
({{context}})->router->CreateLocalEndpointHandle(mojo::internal::FetchAndReset(&{{input}}->{{name}})));
{%- elif kind|is_enum_kind %}
- {{output_field}} = static_cast<{{kind|cpp_wrapper_type}}>({{input}}->{{name}});
+ {{output_field}} = static_cast<{{kind|cpp_wrapper_type}}>({{input}}->{{name}}.value);
{%- else %}
{{output_field}} = {{input}}->{{name}};
{%- endif %}

Powered by Google App Engine
This is Rietveld 408576698