compiler: Don't crash when dumping ast of empty block.
Fixes golang/go#10420. From-SVN: r224487
This commit is contained in:
parent
8e6dce3de7
commit
b18fdafbc9
@ -65,6 +65,12 @@ class Ast_dump_traverse_statements : public Traverse
|
|||||||
|
|
||||||
int Ast_dump_traverse_blocks_and_functions::block(Block * block)
|
int Ast_dump_traverse_blocks_and_functions::block(Block * block)
|
||||||
{
|
{
|
||||||
|
if (block == NULL)
|
||||||
|
{
|
||||||
|
this->ast_dump_context_->ostream() << std::endl;
|
||||||
|
return TRAVERSE_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
this->ast_dump_context_->print_indent();
|
this->ast_dump_context_->print_indent();
|
||||||
this->ast_dump_context_->ostream() << "{" << std::endl;
|
this->ast_dump_context_->ostream() << "{" << std::endl;
|
||||||
this->ast_dump_context_->indent();
|
this->ast_dump_context_->indent();
|
||||||
@ -466,4 +472,4 @@ Ast_dump_context::dump_to_stream(const Expression* expr, std::ostream* out)
|
|||||||
{
|
{
|
||||||
Ast_dump_context adc(out, false);
|
Ast_dump_context adc(out, false);
|
||||||
expr->dump_expression(&adc);
|
expr->dump_expression(&adc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user