- Timestamp:
- 05/15/17 20:37:26 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/destructuring-bind.lisp
r14133 r15004 142 142 (when (eq keyword (car remaining)) 143 143 (return t)))) 144 145 (defun dot-length (cons) 146 (do ((rest cons (cdr rest)) 147 (length 0 (1+ length))) 148 ((or (null rest) (atom rest)) length))) 144 149 145 150 (defun parse-defmacro-lambda-list … … 194 199 env-arg-used t)) 195 200 (t 196 (defmacro-error "&ENVIRONMENT" error-kindname))))201 (defmacro-error "&ENVIRONMENT" name)))) 197 202 ((or (eq var '&rest) (eq var '&body)) 198 203 (cond ((and (cdr rest-of-args) (symbolp (cadr rest-of-args))) … … 210 215 destructuring-lambda-list sub name error-kind error-fun))) 211 216 (t 212 (defmacro-error (symbol-name var) error-kindname))))217 (defmacro-error (symbol-name var) name)))) 213 218 ((eq var '&optional) 214 219 (setq now-processing :optionals)) … … 280 285 (t 281 286 (error "non-symbol in lambda-list: ~S" var))))) 282 ;; Generate code to check the number of arguments, unless dotted 283 ;; in which case length will not work. 284 (unless restp 285 (push `(unless (<= ,minimum 286 (length ,path-0) 287 ,@(unless restp 288 (list maximum))) 289 ,(if (eq error-fun 'error) 290 `(arg-count-error ',error-kind ',name ,path-0 291 ',lambda-list ,minimum 292 ,(unless restp maximum)) 293 `(,error-fun 'arg-count-error 294 :kind ',error-kind 295 ,@(when name `(:name ',name)) 296 :argument ,path-0 297 :lambda-list ',lambda-list 298 :minimum ,minimum 299 ,@(unless restp `(:maximum ,maximum))))) 300 *arg-tests*)) 287 ;; Generate code to check the number of arguments. 288 (push `(unless (<= ,minimum 289 (dot-length ,path-0) 290 ,@(unless restp 291 (list maximum))) 292 ,(if (eq error-fun 'error) 293 `(arg-count-error ',error-kind ',name ,path-0 294 ',lambda-list ,minimum 295 ,(unless restp maximum)) 296 `(,error-fun 'arg-count-error 297 :kind ',error-kind 298 ,@(when name `(:name ',name)) 299 :argument ,path-0 300 :lambda-list ',lambda-list 301 :minimum ,minimum 302 ,@(unless restp `(:maximum ,maximum))))) 303 *arg-tests*) 301 304 (if keys 302 305 (let ((problem (gensym "KEY-PROBLEM-"))
Note: See TracChangeset
for help on using the changeset viewer.