Index: mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
diff --git a/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
index 3841f4d912e4457261263ec275b142fcd9264933..e1fc09e397210c19f1470e867f696cc1fe714ace 100644 |
--- a/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
+++ b/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
@@ -9,6 +9,14 @@ |
{%- macro set_default(field) -%} |
{%- if field.kind|is_string_kind -%} |
set_{{field.name}}(mojo::String({{field.default}})); |
+{%- elif field.kind|is_array_kind -%} |
+{ |
+ {{field.kind|cpp_wrapper_type}}::Builder tmp({{field.default|length}}); |
+{%- for element in field.default %} |
+ tmp[{{loop.index0}}] = {{element}}; |
+{%- endfor %} |
+ set_{{field.name}}(tmp.Finish()); |
+} |
{%- elif field.kind|is_object_kind -%} |
{ |
{{field.kind|cpp_wrapper_type}}::Builder tmp; |