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

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

Issue 2689513003: Add field-initializing constructors to generated mojo structs. (Closed)
Patch Set: rebase Created 3 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: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_template_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_template_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_template_definition.tmpl
index a26601e72ff92f63404e38c43018402c9d015e15..feb861569fd766f5394c25764de2bb85d1253162 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_template_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_template_definition.tmpl
@@ -1,12 +1,11 @@
template <typename StructPtrType>
{{struct.name}}Ptr {{struct.name}}::Clone() const {
- // Use StructPtrType to prevent the compiler from trying to compile this
- // without being asked.
- StructPtrType rv(New());
+ return New(
{%- for field in struct.fields %}
- rv->{{field.name}} = mojo::Clone({{field.name}});
+ mojo::Clone({{field.name}})
+{%- if not loop.last -%},{%- endif %}
{%- endfor %}
- return rv;
+ );
}
template <typename T,

Powered by Google App Engine
This is Rietveld 408576698