Skip to content

Commit

Permalink
Move aliased library name handling into lib.c
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Feb 28, 2014
1 parent e0e8d46 commit b7a85c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/lib.c
Expand Up @@ -493,6 +493,13 @@ static struct lib_unit *lib_get_aux(lib_t lib, ident_t ident)
{
assert(lib != NULL);

// Handle aliased library names
ident_t lname = ident_until(ident, '.');
if (lname != lib->name) {
ident_t uname = ident_rfrom(ident, '.');
ident = ident_prefix(lib->name, uname, '.');
}

// Search in the list of already loaded units
for (unsigned n = 0; n < lib->n_units; n++) {
if (tree_ident(lib->units[n].top) == ident)
Expand Down
6 changes: 0 additions & 6 deletions src/sem.c
Expand Up @@ -1215,12 +1215,6 @@ static bool sem_check_use_clause(tree_t c)

lib_t lib = lib_find(istr(lname), true, true);
if (lib != NULL) {
if (lname != lib_name(lib)) {
ident_t unit = ident_rfrom(cname, '.');
lname = lib_name(lib);
cname = ident_prefix(lname, unit, '.');
}

if (lname == cname) {
assert(all);

Expand Down

0 comments on commit b7a85c4

Please sign in to comment.