Allow queue types outside of classes

Currently the elaboration function for unpacked array types prints an error
for queues that they are not allowed inside classes. And while this error
gets triggered when declaring a property with a queue type, it also gets
triggered for other places that uses a queue type, e.g. a function return
type. The only exception is signals which uses a different internal code
path when elaborating queue types.

Move the error message, that is class property specific, to the class
property elaboration. This also makes sure that the error messages
references the line where the property is declared and not the line where
the type is declared.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-01-18 23:43:59 +01:00
parent c853025305
commit 27f3fcc5f1
2 changed files with 8 additions and 4 deletions

View File

@ -50,6 +50,7 @@
# include "netlist.h"
# include "netclass.h"
# include "netenum.h"
# include "netqueue.h"
# include "parse_api.h"
# include "util.h"
# include <typeinfo>
@ -557,6 +558,13 @@ static void elaborate_scope_class(Design*des, NetScope*scope, PClass*pclass)
<< " Property " << cur->first
<< " type=" << *tmp << endl;
}
if (dynamic_cast<const netqueue_t *> (tmp)) {
cerr << cur->second.get_fileline() << ": sorry: "
<< "Queues inside classes are not yet supported." << endl;
des->errors++;
}
use_class->set_property(cur->first, cur->second.qual, tmp);
}

View File

@ -241,10 +241,6 @@ ivl_type_t uarray_type_t::elaborate_type_raw(Design*des, NetScope*scope) const
// Special case: if the dimension is null:nil. this is a queue.
if (dynamic_cast<PENull*>(cur->first)) {
cerr << get_fileline() << ": sorry: "
<< "SV queues inside classes are not yet supported." << endl;
des->errors += 1;
// FIXME: Need to set the max size if cur->second is defined
ivl_type_s*res = new netqueue_t(btype, -1);
return res;