Permalink
Browse files

prevent '&optional &rest' from occuring in argument lists

clozure warns for these
  • Loading branch information...
1 parent 82df33a commit d977089e04ac7e41d6f6404ab7d7b08753474e20 @marijnh marijnh committed Mar 8, 2011
Showing with 5 additions and 3 deletions.
  1. +2 −1 js.lisp
  2. +3 −2 translate.lisp
View
@@ -61,7 +61,8 @@
((symbolp (car args))
(cons (list (car args) :undefined) (add-default (cdr args))))
(t (cons (car args) (add-default (cdr args)))))))
- (setf args (cons '&optional (add-default args))))
+ (setf args (add-default args))
+ (unless (eq (car args) '&rest) (push '&optional args)))
`(lambda (this ,@args)
(declare (ignorable this ,@(and other '(other-args))))
,@body)))
View
@@ -454,8 +454,9 @@
(defun wrap-function (args body)
`(lambda (,(as-sym "this")
- &optional ,@(loop :for arg :in args :collect
- `(,(as-sym arg) :undefined))
+ ,@(when args '(&optional))
+ ,@(loop :for arg :in args :collect
+ `(,(as-sym arg) :undefined))
&rest extra-args)
(declare (ignore extra-args)
(ignorable ,(as-sym "this") ,@(mapcar 'as-sym args)))

0 comments on commit d977089

Please sign in to comment.