Fix assertion failure when elaborating a void function call (issue #318)
Depending on the order of elaboration, a function may not have been elaborated before a call to it is elaborated, so don't assert that it has been. As an optimisation, try to elaborate it on the fly, so we can elide the call if the function body is empty.
This commit is contained in:
parent
94b503fc64
commit
393236a9a8
|
|
@ -3870,7 +3870,14 @@ NetProc* PCallTask::elaborate_void_function_(Design*des, NetScope*scope,
|
|||
<< endl;
|
||||
}
|
||||
|
||||
ivl_assert(*this, dscope->elab_stage() >= 3);
|
||||
// If we haven't already elaborated the function, do so now.
|
||||
// This allows elaborate_build_call_ to elide the function call
|
||||
// if the function body is empty.
|
||||
if (dscope->elab_stage() < 3) {
|
||||
const PFunction*pfunc = dscope->func_pform();
|
||||
ivl_assert(*this, pfunc);
|
||||
pfunc->elaborate(des, dscope);
|
||||
}
|
||||
return elaborate_build_call_(des, scope, dscope, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue