Struct_field_list* fields = this->fields_;
if (fields == NULL)
return true;
- bool ret = true;
for (Struct_field_list::iterator p = fields->begin();
p != fields->end();
++p)
{
error_at(p->location(), "struct field type is incomplete");
p->set_type(Type::make_error_type());
- ret = false;
}
else if (p->is_anonymous())
{
{
error_at(p->location(), "embedded type may not be a pointer");
p->set_type(Type::make_error_type());
- return false;
}
- if (t->points_to() != NULL
- && t->points_to()->interface_type() != NULL)
+ else if (t->points_to() != NULL
+ && t->points_to()->interface_type() != NULL)
{
error_at(p->location(),
"embedded type may not be pointer to interface");
p->set_type(Type::make_error_type());
- return false;
}
}
}
- return ret;
+ return true;
}
// Whether this contains a pointer.
Array_type::do_verify()
{
if (!this->verify_length())
- {
- this->length_ = Expression::make_error(this->length_->location());
- return false;
- }
+ this->length_ = Expression::make_error(this->length_->location());
return true;
}
{
// The runtime support uses "map[void]void".
if (!this->key_type_->is_comparable() && !this->key_type_->is_void_type())
- {
- error_at(this->location_, "invalid map key type");
- return false;
- }
+ error_at(this->location_, "invalid map key type");
return true;
}
if (this->local_methods_ != NULL)
{
Struct_type* st = this->type_->struct_type();
- bool found_dup = false;
if (st != NULL)
{
for (Bindings::const_declarations_iterator p =
error_at(p->second->location(),
"method %qs redeclares struct field name",
Gogo::message_name(name).c_str());
- found_dup = true;
}
}
}
- if (found_dup)
- return false;
}
return true;
// Verify the type. This is called after parsing, and verifies that
// 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
verify()
{ return this->do_verify(); }