Commit c4675e5e by Ian Lance Taylor

compiler: Avoid unnecessary interface conversions.

From-SVN: r188545
parent f7a70512
...@@ -168,7 +168,8 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type, ...@@ -168,7 +168,8 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
if (lhs_type_tree == error_mark_node) if (lhs_type_tree == error_mark_node)
return error_mark_node; return error_mark_node;
if (lhs_type != rhs_type && lhs_type->interface_type() != NULL) if (lhs_type->forwarded() != rhs_type->forwarded()
&& lhs_type->interface_type() != NULL)
{ {
if (rhs_type->interface_type() == NULL) if (rhs_type->interface_type() == NULL)
return Expression::convert_type_to_interface(context, lhs_type, return Expression::convert_type_to_interface(context, lhs_type,
...@@ -179,7 +180,8 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type, ...@@ -179,7 +180,8 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
rhs_type, rhs_tree, rhs_type, rhs_tree,
false, location); false, location);
} }
else if (lhs_type != rhs_type && rhs_type->interface_type() != NULL) else if (lhs_type->forwarded() != rhs_type->forwarded()
&& rhs_type->interface_type() != NULL)
return Expression::convert_interface_to_type(context, lhs_type, rhs_type, return Expression::convert_interface_to_type(context, lhs_type, rhs_type,
rhs_tree, location); rhs_tree, location);
else if (lhs_type->is_slice_type() && rhs_type->is_nil_type()) else if (lhs_type->is_slice_type() && rhs_type->is_nil_type())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment