Fix key arguments in nested lists
authorDavid Vázquez <davazp@gmail.com>
Sun, 5 May 2013 17:49:12 +0000 (18:49 +0100)
committerDavid Vázquez <davazp@gmail.com>
Sun, 5 May 2013 17:49:12 +0000 (18:49 +0100)
src/lambda-list.lisp

index e87b868..e217333 100644 (file)
@@ -13,7 +13,7 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with JSCL.  If not, see <http://www.gnu.org/licenses/>.
 
-(defconstant !lambda-list-keywords
+(defvar !lambda-list-keywords
   '(&optional &rest &key &aux &allow-other-keys &body &optional))
 
 ;;;; Lambda list parsing
 (defmacro !destructuring-bind (lambda-list expression &body body)
   (multiple-value-bind (d-ll)
       (parse-destructuring-lambda-list lambda-list)
-    (let ((reqvar-count (length (d-lambda-list-reqvars d-ll)))
-          (optvar-count (length (d-lambda-list-optvars d-ll)))
-          (bindings '()))
+    (let ((bindings '()))
       (labels (;; Return a chain of the form (CAR (CDR (CDR ... (CDR X))),
                ;; such that there are N calls to CDR.
                (nth-chain (x n &optional tail)
                ;; against FORM.
                (compute-bindings (d-ll form)
                  (compute-pbindings (d-lambda-list-wholevar d-ll) form)
-                 (let ((count 0))
+                 (let ((reqvar-count (length (d-lambda-list-reqvars d-ll)))
+                       (optvar-count (length (d-lambda-list-optvars d-ll)))
+                       (count 0))
                    ;; Required vars
                    (dolist (reqvar (d-lambda-list-reqvars d-ll))
                      (compute-pbindings reqvar (nth-chain form count))