diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-08-10 22:52:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-08-10 22:52:42 -0700 |
commit | af07e726a7573304b957a3712984f6ecf6167872 (patch) | |
tree | 15b7e2474ece8f3371c728d756e17d356906213e /lib.c | |
parent | f8bca2bc1e7bdb6fde4e61f92fa7b8e6f2295474 (diff) | |
download | txr-af07e726a7573304b957a3712984f6ecf6167872.tar.gz txr-af07e726a7573304b957a3712984f6ecf6167872.tar.bz2 txr-af07e726a7573304b957a3712984f6ecf6167872.zip |
unuse-sym: fix in face of use-sym-as.
* lib.c (unuse_sym): A used symbol may now appear in a package
under a different name. So if we don't find a symbol under
the symbol's name, or find a different symbol, we must try
a reverse hash search before giving up.
* txr.1: Add notes to use-sym-as that unuse-sym must be
used to undo its effect. Add notes to unuse-sym discussing
similarities and differences versus unintern.
* tests/012/use-as.tl: New test cases.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -7359,6 +7359,16 @@ val unuse_sym(val symbol, val package_in) val visible = cdr(found_visible); val hidden = cdr(found_hidden); + if (!found_visible || visible != symbol) { + name = hash_revget(package->pk.symhash, symbol, eq_f, identity_f); + if (name) { + found_visible = gethash_e(self, package->pk.symhash, name); + found_hidden = gethash_e(self, package->pk.hidhash, name); + visible = cdr(found_visible); + hidden = cdr(found_hidden); + } + } + if (!found_visible || visible != symbol) return nil; |