diff --git a/net_scope.cc b/net_scope.cc index cd9e923d0..be9d1c4c6 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -535,7 +535,24 @@ NetFuncDef* NetScope::func_def() bool NetScope::in_func() const { - return (type_ == FUNC) ? true : false; + if (type_ == FUNC) + return true; + + if (type_ == BEGIN_END || type_ == FORK_JOIN || type_ == GENBLOCK) + return up_ ? up_->in_func() : false; + + return false; +} + +bool NetScope::in_final() const +{ + if (in_final_) + return true; + + if (type_ == BEGIN_END || type_ == FORK_JOIN || type_ == GENBLOCK) + return up_ ? up_->in_final() : false; + + return false; } const NetFuncDef* NetScope::func_def() const diff --git a/netlist.h b/netlist.h index 86bfb9b73..d485a5be8 100644 --- a/netlist.h +++ b/netlist.h @@ -1193,7 +1193,7 @@ class NetScope : public Definitions, public Attrib { /* Is this scope elaborating a final procedure? */ void in_final(bool in_final__) { in_final_ = in_final__; }; - bool in_final() const { return in_final_; }; + bool in_final() const; const NetTaskDef* task_def() const; const NetFuncDef* func_def() const;