Use a list instead of a set for storing the potential package imports.
This eliminates some indeterminism in the error messages, which was
causing occasional failures in CI. We don't expect this list to be
very large, so the O(n) insertion time should not be a problem.
(cherry picked from commit 389e2a3a94)
This commit is contained in:
parent
c564184bd1
commit
987ac819a9
2
PScope.h
2
PScope.h
|
|
@ -71,7 +71,7 @@ class LexicalScope {
|
|||
// Packages that are wildcard imported. When identifiers from
|
||||
// these packages are referenced, they will be added to the
|
||||
// explicit imports (IEEE 1800-2012 26.3).
|
||||
std::set<PPackage*>potential_imports;
|
||||
std::list<PPackage*>potential_imports;
|
||||
|
||||
// A task or function call may reference a task or function defined
|
||||
// later in the scope. So here we stash the potential imports for
|
||||
|
|
|
|||
2
pform.cc
2
pform.cc
|
|
@ -478,7 +478,7 @@ static PPackage*find_potential_import(const struct vlltype&loc, LexicalScope*sco
|
|||
assert(scope);
|
||||
|
||||
PPackage*found_pkg = 0;
|
||||
for (set<PPackage*>::const_iterator cur_pkg = scope->potential_imports.begin();
|
||||
for (list<PPackage*>::const_iterator cur_pkg = scope->potential_imports.begin();
|
||||
cur_pkg != scope->potential_imports.end(); ++cur_pkg) {
|
||||
PPackage*search_pkg = *cur_pkg;
|
||||
map<perm_string,PNamedItem*>::const_iterator cur_sym
|
||||
|
|
|
|||
|
|
@ -124,10 +124,12 @@ void pform_package_import(const struct vlltype&loc, PPackage*pkg, const char*ide
|
|||
scope->explicit_imports[use_ident] = pkg;
|
||||
|
||||
} else {
|
||||
set<PPackage*>::const_iterator cur_pkg
|
||||
= scope->potential_imports.find(pkg);
|
||||
list<PPackage*>::const_iterator cur_pkg
|
||||
= find(scope->potential_imports.begin(),
|
||||
scope->potential_imports.end(),
|
||||
pkg);
|
||||
if (cur_pkg == scope->potential_imports.end())
|
||||
scope->potential_imports.insert(pkg);
|
||||
scope->potential_imports.push_back(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue