Fix lexical scopes within case-generate alternatives.

Case-generate alternatives create sub-scopes that need to be scanned
by the scope scanner in order to get function definitions etc. that
are defined lexically within generated scopes.
This commit is contained in:
Stephen Williams 2008-03-02 21:04:04 -08:00
parent 52ac96ca15
commit 32a2e7aa39
4 changed files with 13 additions and 5 deletions

View File

@ -378,7 +378,9 @@ bool NetScope::emit_defs(struct target_t*tgt) const
case TASK:
tgt->task_def(this);
break;
default: /* BEGIN_END and FORK_JOIN, do nothing */
default: /* BEGIN_END and FORK_JOIN, GENERATE... */
for (NetScope*cur = sub_ ; cur ; cur = cur->sib_)
flag &= cur->emit_defs(tgt);
break;
}

View File

@ -3332,9 +3332,9 @@ class NetScope : public Attrib {
void default_nettype(NetNet::Type);
NetNet::Type default_nettype() const;
/* The name of the scope is the fully qualified hierarchical
name, whereas the basename is just my name within my parent
scope. */
/* The fullname of the scope is the hierarchical name
component (which includes the name and array index) whereas
the basename is just my name. */
perm_string basename() const;
const hname_t& fullname() const { return name_; }

View File

@ -1880,6 +1880,7 @@ module_item
| K_function function_range_or_type_opt IDENTIFIER ';'
{ assert(current_function == 0);
current_function = pform_push_function_scope($3);
FILE_NAME(current_function, @1);
}
function_item_list statement
K_endfunction

View File

@ -1454,7 +1454,12 @@ static int show_scope(ivl_scope_t net, void*x)
case IVL_SCT_FUNCTION:
case IVL_SCT_TASK:
fprintf(out, " scope function/task definition\n");
show_statement(ivl_scope_def(net), 6);
if (ivl_scope_def(net) == 0) {
fprintf(out, " ERROR: scope missing required task definition\n");
stub_errors += 1;
} else {
show_statement(ivl_scope_def(net), 6);
}
break;
default: