Don't allow access to imported identifiers through hierarchical names
Imported identifiers should only be visible in the scope they have been
imported too. They should not be accessible through hierarchical names into
that scope. This is defined in section 26.3 ("Referencing data in
packages") of the LRM (1800-2017).
Modify the symbol search to not look at imports if the name is part of a
hierarchical path.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
45bd0968c3
commit
f4d55081ed
|
|
@ -202,11 +202,6 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
|
|||
}
|
||||
}
|
||||
|
||||
if (NetScope*import_scope = scope->find_import(des, path_tail.name)) {
|
||||
scope = import_scope;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Could not find an object. Maybe this is a child scope name? If
|
||||
// so, evaluate the path components to find the exact scope this
|
||||
// refers to. This item might be:
|
||||
|
|
@ -234,6 +229,12 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
|
|||
if (prefix_scope)
|
||||
break;
|
||||
|
||||
// Imports are not visible through hierachical names
|
||||
if (NetScope*import_scope = scope->find_import(des, path_tail.name)) {
|
||||
scope = import_scope;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Special case: We can match the module name of a parent
|
||||
// module. That means if the current scope is a module of type
|
||||
// "mod", then "mod" matches the current scope. This is fairly
|
||||
|
|
|
|||
Loading…
Reference in New Issue