summaryrefslogtreecommitdiffstats
path: root/struct.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-07-02 06:06:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-07-02 06:06:08 -0700
commitf3101cf296dfa0c7f97fd573ded8409905ae9ca1 (patch)
tree95bcc6b8d74c9324a87a8c09fe0f11a02bbd5774 /struct.c
parenta344411316164d4acaf645459b63bc9f9562c2cf (diff)
downloadtxr-f3101cf296dfa0c7f97fd573ded8409905ae9ca1.tar.gz
txr-f3101cf296dfa0c7f97fd573ded8409905ae9ca1.tar.bz2
txr-f3101cf296dfa0c7f97fd573ded8409905ae9ca1.zip
struct: bugfix: autoload on instance slot also.
* struct.c (slot_types): Try lisplib_try_load, just like in static_slot_types. The reason for this is that there is code like (or (sys:slot-types slot) (sys:static-slot-types slot)) which occurs in sys:check-slot, testing both hashes. This code gets fooled in the following way: the sys:slot-types slot reports nil for a particular slot being probed. It doesn't try autoloading, checking the hash just once. Next, sys:static-slot-types is called and triggers an autoload. The autoload instantiates the slot as an instance slot (but not as a static slot). Then sys:static-slot-types returns nil also because there is no such static slot. The effect is that the slot exists due to the autload, but since both functions yielded nil, the overall (or ...) expression yields nil, which is interpreted as the slot not existing.
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index e8a862a7..e12ffcec 100644
--- a/struct.c
+++ b/struct.c
@@ -1885,7 +1885,10 @@ val get_slot_syms(val package, val is_current, val method_only)
val slot_types(val slot)
{
- return gethash(slot_type_hash, slot);
+ uses_or2;
+ return or2(gethash(slot_type_hash, slot),
+ if2(lisplib_try_load(slot),
+ gethash(slot_type_hash, slot)));
}
val static_slot_types(val slot)