diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-05-05 14:54:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-05-05 14:54:30 -0700 |
commit | a716f7122cb5a17257b62e53bdceec0233222c18 (patch) | |
tree | 9b97bfc0c0c456736ca529041c2e37837764b236 /stdlib/struct.tl | |
parent | 22ed56bd3a6eff22bc39577adce319bc7c4d7cf5 (diff) | |
download | txr-a716f7122cb5a17257b62e53bdceec0233222c18.tar.gz txr-a716f7122cb5a17257b62e53bdceec0233222c18.tar.bz2 txr-a716f7122cb5a17257b62e53bdceec0233222c18.zip |
defstruct: diagnostic improvement for boa args.
* struct.tl (defstruct): When generating the lambda that
initializes slots from boa arguments, instead of we use (set
(qref obj slot) val) instead of slotset. The qref macro will
diagnose use of nonexistent slots.Thus warnings are produced
for, say:
(defstruct (point x y) nil)
where x and y have not been defined, using the imperfect
approach of the qref implementation, which is better than
nothing.
Diffstat (limited to 'stdlib/struct.tl')
-rw-r--r-- | stdlib/struct.tl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/struct.tl b/stdlib/struct.tl index 726b7fce..b6f545f4 100644 --- a/stdlib/struct.tl +++ b/stdlib/struct.tl @@ -213,10 +213,10 @@ ,*(if opt-args (mapcar (ret ^(,@1 nil ,@2)) o-gens p-gens))) - ,*(mapcar (ret ^(slotset ,arg-sym ',@1 ,@2)) + ,*(mapcar (ret ^(set (qref ,arg-sym ,@1) ,@2)) req-args r-gens) ,*(mapcar (ret ^(if ,@3 - (slotset ,arg-sym ',@1 ,@2))) + (set (qref ,arg-sym ,@1) ,@2))) opt-args o-gens p-gens)))))) ,(if instance-postinit-forms ^(sys:meth-lambda ,name :postinit (,arg-sym) |