diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-07-10 06:45:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-07-10 06:45:42 -0700 |
commit | acd1500cefaddba4a41689fe6d4d7bd2c99b759e (patch) | |
tree | e3d07e5f5d6807624d40e43d18d284e22990c597 /share | |
parent | 97fa49cc2c9c9c1452316acb003b4c7d104ed162 (diff) | |
download | txr-acd1500cefaddba4a41689fe6d4d7bd2c99b759e.tar.gz txr-acd1500cefaddba4a41689fe6d4d7bd2c99b759e.tar.bz2 txr-acd1500cefaddba4a41689fe6d4d7bd2c99b759e.zip |
compiler: duplicated code when compiling switch.
* share/txr/stdlib/compiler.tl (compiler comp-ift): Fix
incorrect reference to the vec function rather than the
cases-vec local variable. Thus the variable shared is now
correctly calculated, and switch syntax which implements
fall through cases via a single block of shared code is
now translated properly as one block of instructions with
with multiple entry points.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/compiler.tl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index be76f470..04a92bf5 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -532,8 +532,8 @@ (defmeth compiler comp-switch (me oreg env form) (mac-param-bind form (op idx-form cases-vec) form (let* ((ncases (len cases-vec)) - (cs (and (plusp ncases) (conses [vec 0]))) - (shared (and cs (all [vec 1..:] (op memq @1 cs)))) + (cs (and (plusp ncases) (conses [cases-vec 0]))) + (shared (and cs (all [cases-vec 1..:] (op memq @1 cs)))) (cases (if shared (let ((cs-nil ^(,*cs nil))) [mapcar ldiff cs-nil (cdr cs-nil)]) |