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

Unified Diff: mojo/public/bindings/generators/js_templates/struct_definition.tmpl

Issue 164873002: Fix bug with using enums as default values in mojom. We were previously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/bindings/generators/js_templates/struct_definition.tmpl
diff --git a/mojo/public/bindings/generators/js_templates/struct_definition.tmpl b/mojo/public/bindings/generators/js_templates/struct_definition.tmpl
index 4c66df267e187329a32985cab16f91bd3e3dee54..e80e675988c00cf7048c92a3e81888a88848b239 100644
--- a/mojo/public/bindings/generators/js_templates/struct_definition.tmpl
+++ b/mojo/public/bindings/generators/js_templates/struct_definition.tmpl
@@ -1,7 +1,7 @@
{%- macro set_default(kind, value, depth) -%}
{#--- Strings ---#}
{%- if kind|is_string_kind -%}
-{{caller(value)}}
+{{caller(value|expression_to_text(module))}}
{#--- Arrays ---#}
{%- elif kind|is_array_kind %}
{%- set _ = value|verify_token_type("ARRAY") %}
@@ -35,11 +35,12 @@ tmp{{depth}}.{{subfield.name}} = {{result}};
}
{#--- POD types ---#}
{%- else -%}
-{{caller(value|substitute_namespace(imports))}}
+{{caller(value|expression_to_text(module))}}
{%- endif %}
{%- endmacro %}
+{#--- Begin #}
function {{struct.name}}() {
{%- for packed_field in struct.packed.packed_fields %}
{%- if packed_field.field.default %}
« 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