compiler: Don't crash if writing type functions too late due to error.

From-SVN: r185080
This commit is contained in:
Ian Lance Taylor 2012-03-07 21:53:34 +00:00
parent 5ceb809d01
commit d111e30ef3
2 changed files with 11 additions and 0 deletions

View File

@ -398,6 +398,11 @@ class Gogo
void
write_specific_type_functions();
// Whether we are done writing out specific type functions.
bool
specific_type_functions_are_written() const
{ return this->specific_type_functions_are_written_; }
// Traverse the tree. See the Traverse class.
void
traverse(Traverse*);

View File

@ -1790,6 +1790,12 @@ Type::write_specific_type_functions(Gogo* gogo, Named_type* name,
{
Location bloc = Linemap::predeclared_location();
if (gogo->specific_type_functions_are_written())
{
go_assert(saw_errors());
return;
}
Named_object* hash_fn = gogo->start_function(hash_name, hash_fntype, false,
bloc);
gogo->start_block(bloc);