From a716f7122cb5a17257b62e53bdceec0233222c18 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 5 May 2023 14:54:30 -0700 Subject: 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. --- stdlib/struct.tl | 4 ++-- 1 file 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) -- cgit v1.2.3