Index: third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl |
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl |
index 0f19a15e7a9e07c6c8d0aa573597de067b9c39a2..cb4e78516fc5d815cfd2fe74f6e9bf1b1d6d44ad 100644 |
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl |
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_union_class_definition.tmpl |
@@ -43,8 +43,7 @@ bool {{union.name}}::Equals(const {{union.name}}& other) const { |
switch (tag_) { |
{% for field in union.fields %} |
case Tag::{{field.name|upper}}: |
-{% if field.kind|is_object_kind or field.kind|is_any_handle_kind |
- or field.kind|is_interface_kind %} |
+{% if field.kind|is_object_kind or field.kind|is_any_handle_kind %} |
return mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(*(data_.{{field.name}}), *(other.data_.{{field.name}})); |
{%- else %} |
return mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(data_.{{field.name}}, other.data_.{{field.name}}); |
@@ -62,8 +61,7 @@ bool {{union.name}}::is_{{field.name}}() const { |
{{field.kind|cpp_union_getter_return_type}} {{union.name}}::get_{{field.name}}() const { |
MOJO_DCHECK(tag_ == Tag::{{field.name|upper}}); |
-{% if field.kind|is_object_kind or field.kind|is_any_handle_kind |
- or field.kind|is_interface_kind %} |
+{% if field.kind|is_object_kind or field.kind|is_any_handle_kind %} |
return *(data_.{{field.name}}); |
{%- else %} |
return data_.{{field.name}}; |
@@ -74,7 +72,7 @@ void {{union.name}}::set_{{field.name}}({{field.kind|cpp_const_wrapper_type}} {{ |
SwitchActive(Tag::{{field.name|upper}}); |
{% if field.kind|is_string_kind %} |
*(data_.{{field.name}}) = {{field.name}}; |
-{% elif field.kind|is_object_kind or field.kind|is_interface_kind %} |
+{% elif field.kind|is_object_kind %} |
*(data_.{{field.name}}) = {{field.name}}.Pass(); |
{% elif field.kind|is_any_handle_kind %} |
data_.{{field.name}}->reset({{field.name}}.release()); |
@@ -97,8 +95,7 @@ void {{union.name}}::SetActive(Tag new_active) { |
switch (new_active) { |
{% for field in union.fields %} |
case Tag::{{field.name|upper}}: |
-{% if field.kind|is_object_kind or field.kind|is_any_handle_kind |
- or field.kind|is_interface_kind %} |
+{% if field.kind|is_object_kind or field.kind|is_any_handle_kind %} |
data_.{{field.name}} = new {{field.kind|cpp_wrapper_type}}(); |
{%- endif %} |
break; |
@@ -112,8 +109,7 @@ void {{union.name}}::DestroyActive() { |
switch (tag_) { |
{% for field in union.fields %} |
case Tag::{{field.name|upper}}: |
-{% if field.kind|is_object_kind or field.kind|is_any_handle_kind |
- or field.kind|is_interface_kind %} |
+{% if field.kind|is_object_kind or field.kind|is_any_handle_kind %} |
delete data_.{{field.name}}; |
{%- endif %} |
break; |