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

Unified Diff: mojo/public/tools/bindings/generators/js_templates/validation_macros.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/validation_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl b/mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl
index c9821d06009d5899d9dfc74669f738c1bdee4b30..4e5e29adb3a7f576cf2a87bee73a828456bf7057 100644
--- a/mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl
@@ -4,43 +4,43 @@ if (err !== validator.validationError.NONE)
{%- endmacro %}
{%- macro _validate_field(field, offset, name) %}
-{%- if field|is_string_pointer_field %}
+{%- if field.kind|is_string_kind %}
// validate {{name}}
err = messageValidator.validateStringPointer({{offset}}, {{field|validate_nullable_params}})
{{_check_err()}}
-{%- elif field|is_array_pointer_field %}
+{%- elif field.kind|is_array_kind %}
// validate {{name}}
err = messageValidator.validateArrayPointer({{offset}}, {{field|validate_array_params}});
{{_check_err()}}
-{%- elif field|is_struct_pointer_field %}
+{%- elif field.kind|is_struct_kind %}
// validate {{name}}
err = messageValidator.validateStructPointer({{offset}}, {{field|validate_struct_params}});
{{_check_err()}}
-{%- elif field|is_map_pointer_field %}
+{%- elif field.kind|is_map_kind %}
// validate {{name}}
err = messageValidator.validateMapPointer({{offset}}, {{field|validate_map_params}});
{{_check_err()}}
-{%- elif field|is_interface_field %}
+{%- elif field.kind|is_interface_kind %}
// validate {{name}}
err = messageValidator.validateInterface({{offset}}, {{field|validate_nullable_params}});
{{_check_err()}}
-{%- elif field|is_interface_request_field %}
+{%- elif field.kind|is_interface_request_kind %}
// validate {{name}}
err = messageValidator.validateInterfaceRequest({{offset}}, {{field|validate_nullable_params}})
{{_check_err()}}
-{%- elif field|is_associated_interface_field %}
+{%- elif field.kind|is_associated_interface_kind %}
// validate {{name}}
err = messageValidator.validateAssociatedInterface({{offset}}, {{field|validate_nullable_params}});
{{_check_err()}}
-{%- elif field|is_associated_interface_request_field %}
+{%- elif field.kind|is_associated_interface_request_kind %}
// validate {{name}}
err = messageValidator.validateAssociatedInterfaceRequest({{offset}}, {{field|validate_nullable_params}})
{{_check_err()}}
-{%- elif field|is_handle_field %}
+{%- elif field.kind|is_any_handle_kind %}
// validate {{name}}
err = messageValidator.validateHandle({{offset}}, {{field|validate_nullable_params}})
{{_check_err()}}
-{%- elif field|is_enum_field %}
+{%- elif field.kind|is_enum_kind %}
// validate {{name}}
err = messageValidator.validateEnum({{offset}}, {{field|validate_enum_params}});
{{_check_err()}}
@@ -48,7 +48,7 @@ err = messageValidator.validateEnum({{offset}}, {{field|validate_enum_params}});
{%- endmacro %}
{%- macro validate_struct_field(field, offset, name) %}
-{%- if field|is_union_field %}
+{%- if field.kind|is_union_kind %}
// validate {{name}}
err = messageValidator.validateUnion({{offset}}, {{field|validate_union_params}});
{{_check_err()}}
@@ -58,7 +58,7 @@ err = messageValidator.validateUnion({{offset}}, {{field|validate_union_params}}
{%- endmacro %}
{%- macro validate_union_field(field, offset, name) %}
-{%- if field|is_union_field %}
+{%- if field.kind|is_union_kind %}
// validate {{name}}
err = messageValidator.validateNestedUnion({{offset}}, {{field|validate_union_params}});
{{_check_err()}}

Powered by Google App Engine
This is Rietveld 408576698