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

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: 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 f4aa314fae9e1987503f7f92388102120e797809..ca1a612c1e8bee2a7e4a35d7481b5aeaa4d73cd4 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
@@ -2,11 +2,12 @@ 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 StructPtrType::Struct::New(
yzshen1 2017/02/14 17:21:53 This could be "return New(" Right?
Sam McNally 2017/02/15 06:35:49 Done.
{%- for field in struct.fields %}
- rv->{{field.name}} = mojo::internal::Clone({{field.name}});
+ mojo::internal::Clone({{field.name}})
+{%- if not loop.last -%},{%- endif %}
{%- endfor %}
- return rv;
+ );
}
template <typename T,

Powered by Google App Engine
This is Rietveld 408576698