summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-08 06:44:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-08 06:44:00 -0700
commitf6946d73027e1f3213336a6fd721f4ab85036664 (patch)
tree8e93cb2cd7026ed149a27495d965065e9ab10eee /tests
parent6752067fbbeb3813fe991a02c03dd26dd6aae1b0 (diff)
downloadtxr-f6946d73027e1f3213336a6fd721f4ab85036664.tar.gz
txr-f6946d73027e1f3213336a6fd721f4ab85036664.tar.bz2
txr-f6946d73027e1f3213336a6fd721f4ab85036664.zip
Optimize qref and sys:rslot using slet.
* share/txr/stdlib/struct.tl (qref): Use slet instead of let in expansion so that in the common case of var.(method ...) the expansion simply produces a form with var evaluated in two places. (sys:rslot): Use slet instead of rlet. * tests/012/struct.tl: Update qref expansion test-cases to test for the now simpler expansions.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/struct.tl22
1 files changed, 8 insertions, 14 deletions
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)