Index: mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
index 8a8c5b0aca20d303addf6a625aabea223009370c..0d556a2d1d8509e5e48aa9811966006b12f42538 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl |
@@ -8,12 +8,14 @@ |
{%- if not kind|is_nullable_kind %} |
{%- if kind|is_union_kind and union_is_inlined %} |
if (!mojo::internal::ValidateInlinedUnionNonNullable( |
- {{field_expr}}, "null {{name}} field in {{object_name}}")) { |
+ {{field_expr}}, "null {{name}} field in {{object_name}}", |
+ validation_context)) { |
return false; |
} |
{%- else %} |
if (!mojo::internal::ValidatePointerNonNullable( |
- {{field_expr}}, "null {{name}} field in {{object_name}}")) { |
+ {{field_expr}}, "null {{name}} field in {{object_name}}", |
+ validation_context)) { |
return false; |
} |
{%- endif %} |
@@ -21,26 +23,27 @@ |
{%- if kind|is_array_kind or kind|is_string_kind %} |
const mojo::internal::ContainerValidateParams {{name}}_validate_params( |
{{kind|get_container_validate_params_ctor_args|indent(6)}}); |
- if (!mojo::internal::ValidateArray({{field_expr}}, bounds_checker, |
+ if (!mojo::internal::ValidateArray({{field_expr}}, validation_context, |
&{{name}}_validate_params)) { |
return false; |
} |
{%- elif kind|is_map_kind %} |
const mojo::internal::ContainerValidateParams {{name}}_validate_params( |
{{kind|get_container_validate_params_ctor_args|indent(6)}}); |
- if (!mojo::internal::ValidateMap({{field_expr}}, bounds_checker, |
+ if (!mojo::internal::ValidateMap({{field_expr}}, validation_context, |
&{{name}}_validate_params)) { |
return false; |
} |
{%- elif kind|is_struct_kind %} |
- if (!mojo::internal::ValidateStruct({{field_expr}}, bounds_checker)) |
+ if (!mojo::internal::ValidateStruct({{field_expr}}, validation_context)) |
return false; |
{%- elif kind|is_union_kind %} |
{%- if union_is_inlined %} |
- if (!mojo::internal::ValidateInlinedUnion({{field_expr}}, bounds_checker)) |
+ if (!mojo::internal::ValidateInlinedUnion({{field_expr}}, validation_context)) |
return false; |
{%- else %} |
- if (!mojo::internal::ValidateNonInlinedUnion({{field_expr}}, bounds_checker)) |
+ if (!mojo::internal::ValidateNonInlinedUnion({{field_expr}}, |
+ validation_context)) |
return false; |
{%- endif %} |
{%- else %} |
@@ -62,11 +65,11 @@ |
{%- if not kind|is_nullable_kind %} |
if (!mojo::internal::ValidateHandleNonNullable( |
{{name}}_handle, |
- "invalid {{name}} field in {{object_name}}")) { |
+ "invalid {{name}} field in {{object_name}}", validation_context)) { |
return false; |
} |
{%- endif %} |
- if (!mojo::internal::ValidateHandle({{name}}_handle, bounds_checker)) |
+ if (!mojo::internal::ValidateHandle({{name}}_handle, validation_context)) |
return false; |
{%- endmacro %} |
@@ -85,18 +88,21 @@ |
{%- if not kind|is_nullable_kind %} |
if (!mojo::internal::ValidateInterfaceIdNonNullable( |
{{name}}_interface_id, |
- "invalid {{name}} field in {{object_name}}")) { |
+ "invalid {{name}} field in {{object_name}}", validation_context)) { |
return false; |
} |
{%- endif %} |
- if (!mojo::internal::ValidateAssociatedInterfaceId({{name}}_interface_id)) |
+ if (!mojo::internal::ValidateAssociatedInterfaceId({{name}}_interface_id, |
+ validation_context)) { |
return false; |
+ } |
{%- endmacro %} |
{#- Validates the specified field, which is supposed to be an enum. |
This macro is expanded by the Validate() method. #} |
{%- macro validate_enum(field, field_expr) %} |
- if (!{{field.kind|get_qualified_name_for_kind(internal=True)}}::Validate({{field_expr}})) |
+ if (!{{field.kind|get_qualified_name_for_kind(internal=True)}} |
+ ::Validate({{field_expr}}, validation_context)) |
return false; |
{%- endmacro %} |