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

Unified Diff: mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl

Issue 2864753002: Mojo code generator: simplify how imported types and values are handled. (Closed)
Patch Set: . Created 3 years, 7 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/js_templates/union_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl
index 4823febeca9f20b1ffcfe685962e12ab8f28a570..dde69aeffdaab9344bfd8bc937208680e30462ca 100644
--- a/mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl
@@ -89,7 +89,7 @@ Object.defineProperty({{union.name}}.prototype, "{{field.name}}", {
switch (val.$tag) {
{%- for field in union.fields %}
case {{union.name}}.Tags.{{field.name}}:
-{%- if field|is_bool_field %}
+{%- if field.kind|is_bool_kind %}
encoder.writeUint8(val.{{field.name}} ? 1 : 0);
{%- else %}
encoder.{{field.kind|union_encode_snippet}}val.{{field.name}});
@@ -115,7 +115,7 @@ Object.defineProperty({{union.name}}.prototype, "{{field.name}}", {
switch (tag) {
{%- for field in union.fields %}
case {{union.name}}.Tags.{{field.name}}:
-{%- if field|is_bool_field %}
+{%- if field.kind|is_bool_kind %}
result.{{field.name}} = decoder.readUint8() ? true : false;
{%- else %}
result.{{field.name}} = decoder.{{field.kind|union_decode_snippet}};

Powered by Google App Engine
This is Rietveld 408576698