summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-05 14:54:30 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-05 14:54:30 -0700
commit0393135ad97a5f5d076e7ad7ee24f1ba9737ae89 (patch)
tree9b97bfc0c0c456736ca529041c2e37837764b236
parentfd8187e678173cdf9f6d3fa6839e45e74954f2b3 (diff)
downloadtxr-0393135ad97a5f5d076e7ad7ee24f1ba9737ae89.tar.gz
txr-0393135ad97a5f5d076e7ad7ee24f1ba9737ae89.tar.bz2
txr-0393135ad97a5f5d076e7ad7ee24f1ba9737ae89.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.
-rw-r--r--stdlib/struct.tl4
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)