summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/struct.tl6
-rw-r--r--tests/012/struct.tl22
2 files changed, 11 insertions, 17 deletions
diff --git a/share/txr/stdlib/struct.tl b/share/txr/stdlib/struct.tl
index 9b37ae0b..0f3d79eb 100644
--- a/share/txr/stdlib/struct.tl
+++ b/share/txr/stdlib/struct.tl
@@ -196,11 +196,11 @@
(if (eq dw 'dwim) ^(qref [(slot ,obj ',sym) ,*args] ,*more) :))
(((sym . args))
(let ((osym (gensym)))
- ^(let ((,osym ,obj))
+ ^(slet ((,osym ,obj))
(call (slot ,osym ',sym) ,osym ,*args))))
(((sym . args) . more)
(let ((osym (gensym)))
- ^(qref (let ((,osym ,obj))
+ ^(qref (slet ((,osym ,obj))
(call (slot ,osym ',sym) ,osym ,*args)) ,*more)))
((sym) ^(slot ,obj ',sym))
((sym . more) ^(qref (slot ,obj ',sym) ,*more))
@@ -270,7 +270,7 @@
(defplace (sys:rslot struct sym meth-sym) body
(getter setter
(with-gensyms (struct-sym slot-sym meth-sym)
- ^(rlet ((,struct-sym ,struct)
+ ^(slet ((,struct-sym ,struct)
(,slot-sym ,sym)
(,meth-sym ,meth-sym))
(macrolet ((,getter () ^(slot ,',struct-sym ,',slot-sym))
diff --git a/tests/012/struct.tl b/tests/012/struct.tl
index e7c025f4..de5ab0f8 100644
--- a/tests/012/struct.tl
+++ b/tests/012/struct.tl
@@ -38,30 +38,24 @@
(set *gensym-counter* 0)
(stest (sys:expand 's.(a))
- "(let ((#:g0004 s))\n \
- \ (call (slot #:g0004 'a)\n \
- \ #:g0004))")
+ "(call (slot s 'a)\n \
+ \ s)")
(set *gensym-counter* 0)
(stest (sys:expand 's.(a b c))
- "(let ((#:g0004 s))\n \
- \ (call (slot #:g0004 'a)\n \
- \ #:g0004 b c))")
+ "(call (slot s 'a)\n \
+ \ s b c)")
(test (sys:expand 's.[a].d)
(slot [(slot s 'a)] 'd))
(test (sys:expand 's.[a b c].d)
(slot [(slot s 'a) b c] 'd))
(set *gensym-counter* 0)
(stest (sys:expand 's.(a).d)
- "(slot (let ((#:g0004 s))\n \
- \ (call (slot #:g0004 'a)\n \
- \ #:g0004))\n \
- \ 'd)")
+ "(slot (call (slot s 'a)\n \
+ \ s) 'd)")
(set *gensym-counter* 0)
(stest (sys:expand 's.(a b c).d)
- "(slot (let ((#:g0004 s))\n \
- \ (call (slot #:g0004 'a)\n \
- \ #:g0004 b c))\n \
- \ 'd)")
+ "(slot (call (slot s 'a)\n \
+ \ s b c)\n 'd)")
(test s.a 100)