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

Side by Side Diff: mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl

Issue 159983003: Fix a bug with mojom imports where 2 imports with the same namespace would (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 {%- set class_name = struct.name -%} 1 {%- set class_name = struct.name -%}
2 {%- set dtor_name = [] %} 2 {%- set dtor_name = [] %}
3 {%- if struct|is_struct_with_handles %} 3 {%- if struct|is_struct_with_handles %}
4 {%- set _ = dtor_name.append("&internal::%s_Data_Destructor"|format(struct.nam e)) %} 4 {%- set _ = dtor_name.append("&internal::%s_Data_Destructor"|format(struct.nam e)) %}
5 {%- else %} 5 {%- else %}
6 {%- set _ = dtor_name.append("NULL") %} 6 {%- set _ = dtor_name.append("NULL") %}
7 {%- endif %} 7 {%- endif %}
8 8
9 {%- macro set_default(kind, value, depth) -%} 9 {%- macro set_default(kind, value, depth) -%}
10 {#--- Strings ---#} 10 {#--- Strings ---#}
11 {%- if kind|is_string_kind -%} 11 {%- if kind|is_string_kind -%}
12 {{caller("mojo::String(" ~ value ~ ")")}} 12 {{caller("mojo::String(" ~ value|substitute_namespace(imports) ~ ")")}}
13 {#--- Arrays ---#} 13 {#--- Arrays ---#}
14 {%- elif kind|is_array_kind %} 14 {%- elif kind|is_array_kind %}
15 {%- set _ = value|verify_token_type("ARRAY") %} 15 {%- set _ = value|verify_token_type("ARRAY") %}
16 { 16 {
17 {{kind|cpp_wrapper_type}}::Builder tmp{{depth}}({{value[1]|length}}); 17 {{kind|cpp_wrapper_type}}::Builder tmp{{depth}}({{value[1]|length}});
18 {%- for element in value[1] %} 18 {%- for element in value[1] %}
19 {%- filter indent(2) %} 19 {%- filter indent(2) %}
20 {%- call(result) set_default(kind.kind, element, depth+1) %} 20 {%- call(result) set_default(kind.kind, element, depth+1) %}
21 tmp{{depth}}[{{loop.index0}}] = {{result}}; 21 tmp{{depth}}[{{loop.index0}}] = {{result}};
22 {%- endcall %} 22 {%- endcall %}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 {%- endcall %} 56 {%- endcall %}
57 {%- endfilter %} 57 {%- endfilter %}
58 {%- endfor %} 58 {%- endfor %}
59 } 59 }
60 60
61 {{class_name}} {{class_name}}::Builder::Finish() { 61 {{class_name}} {{class_name}}::Builder::Finish() {
62 Data* data = NULL; 62 Data* data = NULL;
63 std::swap(data, data_); 63 std::swap(data, data_);
64 return mojo::internal::Wrap(data); 64 return mojo::internal::Wrap(data);
65 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698