summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-08 07:24:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-08 07:24:11 -0700
commitc02a785e184433ce9b5a14239f29704831a2c95c (patch)
tree2bd1b98ebaabd0c7832d79f51dcb616d118165ec /share
parent82e668def2120b1f00fadd9b5d89c45a3fb54467 (diff)
downloadtxr-c02a785e184433ce9b5a14239f29704831a2c95c.tar.gz
txr-c02a785e184433ce9b5a14239f29704831a2c95c.tar.bz2
txr-c02a785e184433ce9b5a14239f29704831a2c95c.zip
trace: bugfix: redefine check mustn't throw exceptions.
* share/txr/stdlib/trace.tl (sys:trace-canonicalize-name): Don't call static-slot-home on something that might not be a struct type symbol. Otherwise the trace module will throw whenever some lookup is performed for a non-existent method. That means that when trace is loaded, it is impossible to define a method with defun.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/trace.tl16
1 files changed, 10 insertions, 6 deletions
diff --git a/share/txr/stdlib/trace.tl b/share/txr/stdlib/trace.tl
index 44dba55f..4815ab4f 100644
--- a/share/txr/stdlib/trace.tl
+++ b/share/txr/stdlib/trace.tl
@@ -41,12 +41,16 @@
(defun sys:trace-canonicalize-name (name)
(if (and (consp name)
(eq (car name) 'meth))
- (let* ((req-type (cadr name))
- (sym (caddr name)))
- (let ((actual-type (static-slot-home req-type sym)))
- (if (eq req-type actual-type)
- name
- ^(meth ,actual-type ,sym))))
+ (let* ((req-type-sym (cadr name))
+ (slot-sym (caddr name))
+ (req-type (find-struct-type req-type-sym))
+ (s-s-p (if req-type
+ (static-slot-p req-type slot-sym)))
+ (actual-type-sym (if s-s-p
+ (static-slot-home req-type-sym slot-sym))))
+ (if (and s-s-p (neq req-type-sym actual-type-sym))
+ ^(meth ,actual-type-sym ,slot-sym)
+ name))
name))
(defun sys:trace (names)