Commit a0c996ea by Ian Lance Taylor

compiler: Fix handling of invalid types within invalid types.

From-SVN: r184674
parent a339c9d6
...@@ -4116,7 +4116,6 @@ Struct_type::do_verify() ...@@ -4116,7 +4116,6 @@ Struct_type::do_verify()
Struct_field_list* fields = this->fields_; Struct_field_list* fields = this->fields_;
if (fields == NULL) if (fields == NULL)
return true; return true;
bool ret = true;
for (Struct_field_list::iterator p = fields->begin(); for (Struct_field_list::iterator p = fields->begin();
p != fields->end(); p != fields->end();
++p) ++p)
...@@ -4126,7 +4125,6 @@ Struct_type::do_verify() ...@@ -4126,7 +4125,6 @@ Struct_type::do_verify()
{ {
error_at(p->location(), "struct field type is incomplete"); error_at(p->location(), "struct field type is incomplete");
p->set_type(Type::make_error_type()); p->set_type(Type::make_error_type());
ret = false;
} }
else if (p->is_anonymous()) else if (p->is_anonymous())
{ {
...@@ -4134,19 +4132,17 @@ Struct_type::do_verify() ...@@ -4134,19 +4132,17 @@ Struct_type::do_verify()
{ {
error_at(p->location(), "embedded type may not be a pointer"); error_at(p->location(), "embedded type may not be a pointer");
p->set_type(Type::make_error_type()); p->set_type(Type::make_error_type());
return false;
} }
if (t->points_to() != NULL else if (t->points_to() != NULL
&& t->points_to()->interface_type() != NULL) && t->points_to()->interface_type() != NULL)
{ {
error_at(p->location(), error_at(p->location(),
"embedded type may not be pointer to interface"); "embedded type may not be pointer to interface");
p->set_type(Type::make_error_type()); p->set_type(Type::make_error_type());
return false;
} }
} }
} }
return ret; return true;
} }
// Whether this contains a pointer. // Whether this contains a pointer.
...@@ -5206,10 +5202,7 @@ bool ...@@ -5206,10 +5202,7 @@ bool
Array_type::do_verify() Array_type::do_verify()
{ {
if (!this->verify_length()) if (!this->verify_length())
{ this->length_ = Expression::make_error(this->length_->location());
this->length_ = Expression::make_error(this->length_->location());
return false;
}
return true; return true;
} }
...@@ -5899,10 +5892,7 @@ Map_type::do_verify() ...@@ -5899,10 +5892,7 @@ Map_type::do_verify()
{ {
// The runtime support uses "map[void]void". // The runtime support uses "map[void]void".
if (!this->key_type_->is_comparable() && !this->key_type_->is_void_type()) if (!this->key_type_->is_comparable() && !this->key_type_->is_void_type())
{ error_at(this->location_, "invalid map key type");
error_at(this->location_, "invalid map key type");
return false;
}
return true; return true;
} }
...@@ -7885,7 +7875,6 @@ Named_type::do_verify() ...@@ -7885,7 +7875,6 @@ Named_type::do_verify()
if (this->local_methods_ != NULL) if (this->local_methods_ != NULL)
{ {
Struct_type* st = this->type_->struct_type(); Struct_type* st = this->type_->struct_type();
bool found_dup = false;
if (st != NULL) if (st != NULL)
{ {
for (Bindings::const_declarations_iterator p = for (Bindings::const_declarations_iterator p =
...@@ -7899,12 +7888,9 @@ Named_type::do_verify() ...@@ -7899,12 +7888,9 @@ Named_type::do_verify()
error_at(p->second->location(), error_at(p->second->location(),
"method %qs redeclares struct field name", "method %qs redeclares struct field name",
Gogo::message_name(name).c_str()); Gogo::message_name(name).c_str());
found_dup = true;
} }
} }
} }
if (found_dup)
return false;
} }
return true; return true;
......
...@@ -510,7 +510,8 @@ class Type ...@@ -510,7 +510,8 @@ class Type
// Verify the type. This is called after parsing, and verifies that // Verify the type. This is called after parsing, and verifies that
// types are complete and meet the language requirements. This // types are complete and meet the language requirements. This
// returns false if the type is invalid. // returns false if the type is invalid and we should not continue
// traversing it.
bool bool
verify() verify()
{ return this->do_verify(); } { return this->do_verify(); }
......
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