summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-01-16 00:34:06 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-01-16 00:34:06 -0800
commitaceb4cade5c3b407da7133bdabf04a59f038c324 (patch)
tree3f7b941916e0966dd971d44327fbbd8f46fbff94 /share
parentdd99f2a90d3583142dad69f2e89105b686299722 (diff)
downloadtxr-aceb4cade5c3b407da7133bdabf04a59f038c324.tar.gz
txr-aceb4cade5c3b407da7133bdabf04a59f038c324.tar.bz2
txr-aceb4cade5c3b407da7133bdabf04a59f038c324.zip
defmeth uses new error reporting.
* share/txr/stdlib/struct.tl (sys:defmeth): Removing checks from here. (defmeth): Add checks here with new functions which provide location info and warning deferral/supression.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/struct.tl15
1 files changed, 9 insertions, 6 deletions
diff --git a/share/txr/stdlib/struct.tl b/share/txr/stdlib/struct.tl
index b1d0acfd..e3e711a4 100644
--- a/share/txr/stdlib/struct.tl
+++ b/share/txr/stdlib/struct.tl
@@ -241,13 +241,16 @@
^[(fun umethod) ',slot ,*bound-args])
(defun sys:defmeth (type-sym name fun)
- (let ((type (find-struct-type type-sym)))
- (unless type
- (throwf 'eval-error "~s: ~s isn't a struct type" 'defmeth type-sym))
- (static-slot-ensure type-sym name fun)
- ^(meth ,type-sym ,name)))
+ (static-slot-ensure type-sym name fun)
+ ^(meth ,type-sym ,name))
-(defmacro defmeth (type-sym name arglist . body)
+(defmacro defmeth (:form form type-sym name arglist . body)
+ (cond
+ ((not (bindable type-sym))
+ (compile-error form "~s isn't a valid struct name" type-sym))
+ ((not (find-struct-type type-sym))
+ (compile-defr-warning form ^(struct-type . ,type-sym)
+ "definition of struct ~s not seen here" type-sym)))
^(sys:defmeth ',type-sym ',name (lambda ,arglist
(block ,name ,*body))))