vhdlpp: ProcessStatement inherits after ScopeBase.

This commit is contained in:
Maciej Suminski 2016-02-18 10:32:51 +01:00
parent 25cd0827ba
commit b037d533f9
5 changed files with 24 additions and 14 deletions

View File

@ -260,9 +260,10 @@ StatementList::~StatementList()
}
ProcessStatement::ProcessStatement(perm_string iname,
const ActiveScope&ref,
std::list<Expression*>*sensitivity_list,
std::list<SequentialStmt*>*statements_list)
: StatementList(statements_list), iname_(iname)
: StatementList(statements_list), Scope(ref), iname_(iname)
{
if (sensitivity_list)
sensitivity_list_.splice(sensitivity_list_.end(), *sensitivity_list);

View File

@ -271,10 +271,11 @@ class FinalStatement : public StatementList {
void dump(ostream&out, int indent =0) const;
};
class ProcessStatement : public StatementList {
class ProcessStatement : public StatementList, public Scope {
public:
ProcessStatement(perm_string iname,
const ActiveScope&ref,
std::list<Expression*>*sensitivity_list,
std::list<SequentialStmt*>*statement_list);
~ProcessStatement();

View File

@ -202,7 +202,6 @@ int ProcessStatement::elaborate(Entity*ent, Architecture*arc)
{
int errors = 0;
StatementList::elaborate(ent, arc);
return errors;

View File

@ -361,6 +361,8 @@ int ProcessStatement::emit(ostream&out, Entity*ent, Architecture*arc)
else
out << "always begin" << endl;
emit_variables(out, ent, arc);
int errors = StatementList::emit(out, ent, arc);
if (! sensitivity_list_.empty()) {

View File

@ -778,7 +778,10 @@ concurrent_assertion_statement
std::list<SequentialStmt*> stmts;
stmts.push_back($1);
stmts.push_back(new WaitStmt(WaitStmt::FINAL, NULL));
ProcessStatement*tmp = new ProcessStatement(empty_perm_string, NULL, &stmts);
push_scope();
ProcessStatement*tmp = new ProcessStatement(empty_perm_string, *active_scope,
NULL, &stmts);
pop_scope();
FILE_NAME(tmp, @1);
$$ = tmp;
}
@ -2089,26 +2092,30 @@ process_declarative_part_opt
process_statement
: identifier_colon_opt K_postponed_opt K_process
{
push_scope();
}
process_sensitivity_list_opt K_is_opt
process_declarative_part_opt
K_begin sequence_of_statements
K_end K_postponed_opt K_process identifier_opt ';'
{ perm_string iname = $1? lex_strings.make($1) : empty_perm_string;
if ($1) delete[]$1;
if ($12) {
if ($13) {
if (iname.nil()) {
errormsg(@12, "Process end name %s for un-named processes.\n", $12);
} else if (iname != $12) {
errormsg(@12, "Process name %s does not match opening name %s.\n",
$12, $1);
errormsg(@13, "Process end name %s for un-named processes.\n", $13);
} else if (iname != $13) {
errormsg(@13, "Process name %s does not match opening name %s.\n",
$13, $1);
}
delete[]$12;
delete[]$13;
}
ProcessStatement*tmp = new ProcessStatement(iname, $4, $8);
FILE_NAME(tmp, @3);
delete $4;
delete $8;
ProcessStatement*tmp = new ProcessStatement(iname, *active_scope, $5, $9);
pop_scope();
FILE_NAME(tmp, @4);
delete $5;
delete $9;
$$ = tmp;
}