summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-01 09:14:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-03-01 09:14:26 -0800
commit0a2923dd24398c24a60c9cd0031c4079b211fdc9 (patch)
tree8a535c156cddeaf09498028a30b4bb0a7616ddbc
parentdf3789cfece5eaa149d76b07eda310c607288fbb (diff)
downloadtxr-0a2923dd24398c24a60c9cd0031c4079b211fdc9.tar.gz
txr-0a2923dd24398c24a60c9cd0031c4079b211fdc9.tar.bz2
txr-0a2923dd24398c24a60c9cd0031c4079b211fdc9.zip
trace: bugfix in method redefinition check.
If the trace module has been loaded, we can't define methods. Repro: 1> (trace) nil 2> (defmeth time foo (me)) ** static-slot-home: #<struct-type time> has no static slot named foo * struct.c (static_slot_ensure): Do the trace_check after calling static_slot_ens_rec so that the slot exists. If the slot doesn't exist, an exception occurs when sys:trace-canonicalize-name calls static-slot-home.
-rw-r--r--struct.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/struct.c b/struct.c
index 0e8b1080..35af3136 100644
--- a/struct.c
+++ b/struct.c
@@ -1177,19 +1177,22 @@ static val static_slot_ens_rec(val stype, val sym, val newval,
val static_slot_ensure(val stype, val sym, val newval, val no_error_p)
{
val self = lit("static-slot-ensure");
+ val res;
if (!bindable(sym))
uw_throwf(error_s, lit("~a: ~s isn't a valid slot name"),
self, sym, nao);
+ no_error_p = default_null_arg(no_error_p);
+ res = static_slot_ens_rec(stype, sym, newval, no_error_p, self, 0);
+
if (trace_loaded) {
struct struct_type *st = stype_handle(&stype, self);
val name = list(meth_s, st->name, sym, nao);
trace_check(name);
}
- no_error_p = default_null_arg(no_error_p);
- return static_slot_ens_rec(stype, sym, newval, no_error_p, self, 0);
+ return res;
}
val static_slot_home(val stype, val sym)