Handle the special case that constructor only chains.

Fix the case that a constructure is only a chaining constructor,
with no other content.
This commit is contained in:
Stephen Williams 2020-11-22 16:13:01 -08:00
parent 156644d91e
commit 919fd22a79
1 changed files with 3 additions and 2 deletions

View File

@ -43,7 +43,7 @@ void PFunction::set_statement(Statement*s)
void PFunction::push_statement_front(Statement*stmt)
{
// This can only happen after the statement is initially set.
// This should not be possible.
ivl_assert(*this, statement_);
// Get the PBlock of the statement. If it is not a PBlock,
@ -75,7 +75,8 @@ PChainConstructor* PFunction::extract_chain_constructor()
PChainConstructor*res = 0;
if ((res = dynamic_cast<PChainConstructor*> (statement_))) {
statement_ = 0;
statement_ = new PBlock(PBlock::BL_SEQ);
statement_->set_line(*this);
} else if (PBlock*blk = dynamic_cast<PBlock*>(statement_)) {
res = blk->extract_chain_constructor();