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

Side by Side Diff: mojo/public/bindings/generators/js_templates/struct_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 {%- macro set_default(kind, value, depth) -%} 1 {%- macro set_default(kind, value, depth) -%}
2 {#--- Strings ---#} 2 {#--- Strings ---#}
3 {%- if kind|is_string_kind -%} 3 {%- if kind|is_string_kind -%}
4 {{caller(value)}} 4 {{caller(value)}}
5 {#--- Arrays ---#} 5 {#--- Arrays ---#}
6 {%- elif kind|is_array_kind %} 6 {%- elif kind|is_array_kind %}
7 {%- set _ = value|verify_token_type("ARRAY") %} 7 {%- set _ = value|verify_token_type("ARRAY") %}
8 { 8 {
9 var tmp{{depth}} = []; 9 var tmp{{depth}} = [];
10 {%- for element in value[1] %} 10 {%- for element in value[1] %}
(...skipping 17 matching lines...) Expand all
28 {%- filter indent(2) %} 28 {%- filter indent(2) %}
29 {%- call(result) set_default(subfield.kind, element, depth+1) %} 29 {%- call(result) set_default(subfield.kind, element, depth+1) %}
30 tmp{{depth}}.{{subfield.name}} = {{result}}; 30 tmp{{depth}}.{{subfield.name}} = {{result}};
31 {%- endcall %} 31 {%- endcall %}
32 {%- endfilter %} 32 {%- endfilter %}
33 {%- endfor -%} 33 {%- endfor -%}
34 {{caller("tmp" ~ depth)|indent(2)}} 34 {{caller("tmp" ~ depth)|indent(2)}}
35 } 35 }
36 {#--- POD types ---#} 36 {#--- POD types ---#}
37 {%- else -%} 37 {%- else -%}
38 {{caller(value)}} 38 {{caller(value|substitute_namespace(imports))}}
39 {%- endif %} 39 {%- endif %}
40 {%- endmacro %} 40 {%- endmacro %}
41 41
42 42
43 function {{struct.name}}() { 43 function {{struct.name}}() {
44 {%- for packed_field in struct.packed.packed_fields %} 44 {%- for packed_field in struct.packed.packed_fields %}
45 {%- if packed_field.field.default %} 45 {%- if packed_field.field.default %}
46 {%- filter indent(4) %} 46 {%- filter indent(4) %}
47 {%- call(result) set_default(packed_field.field.kind, packed_field.field.def ault, 0) %} 47 {%- call(result) set_default(packed_field.field.kind, packed_field.field.def ault, 0) %}
48 this.{{packed_field.field.name}} = {{result}}; 48 this.{{packed_field.field.name}} = {{result}};
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 {%- else %} 101 {%- else %}
102 {%- for packed_field in byte.packed_fields %} 102 {%- for packed_field in byte.packed_fields %}
103 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n ame}}); 103 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n ame}});
104 {%- endfor %} 104 {%- endfor %}
105 {%- endif %} 105 {%- endif %}
106 {%- if byte.is_padding %} 106 {%- if byte.is_padding %}
107 encoder.skip(1); 107 encoder.skip(1);
108 {%- endif %} 108 {%- endif %}
109 {%- endfor %} 109 {%- endfor %}
110 }; 110 };
OLDNEW
« no previous file with comments | « mojo/public/bindings/generators/js_templates/module.js.tmpl ('k') | mojo/public/bindings/generators/mojom_cpp_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698