Raymond Toy pushed to branch issue-417-defmethod-check-aux-vars at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/pcl/low.lisp
    ... ... @@ -357,41 +357,40 @@ the compiler as completely as possible. Currently this means that
    357 357
         (when morep
    
    358 358
           (simple-program-error "~@<~s not allowed here~@:>" 'c:&more))
    
    359 359
         (collect ((vars))
    
    360
    -      (labels ((check-var (var &optional allow-repeated-lambda-vars)
    
    361
    -		 (cond ((not (symbolp var))
    
    362
    -			(simple-program-error
    
    363
    -			 "~@<Invalid lambda variable: ~s~@:>" var))
    
    364
    -		       ((and (not allow-repeated-lambda-vars)
    
    365
    -			     (memq var (vars)))
    
    366
    -			(simple-program-error
    
    367
    -			 "~@<Repeated lambda variable: ~s~@:>" var))
    
    368
    -		       (t
    
    369
    -			(vars var))))
    
    360
    +      (labels ((check-lambda-variable (var)
    
    361
    +		 (unless (symbolp var)
    
    362
    +		   (simple-program-error
    
    363
    +		    "~@<Invalid lambda variable: ~s~@:>" var)))
    
    364
    +	       (check-var (var)
    
    365
    +		 (check-lambda-variable var)
    
    366
    +		 (if (memq var (vars))
    
    367
    +		     (simple-program-error
    
    368
    +		      "~@<Repeated lambda variable: ~s~@:>" var)
    
    369
    +		     (vars var)))
    
    370
    +	       (check-aux (var)
    
    371
    +		 (if (consp var)
    
    372
    +		     (check-lambda-variable (car var))
    
    373
    +		     (check-lambda-variable var)))
    
    370 374
     	       (check-required (var)
    
    371 375
     		 (if (and (consp var) specialized-p)
    
    372 376
     		     (check-var (car var))
    
    373 377
     		     (check-var var)))
    
    374
    -	       (check-optional (var &optional allow-repeated-lambda-vars)
    
    378
    +	       (check-optional (var)
    
    375 379
     		 (if (consp var)
    
    376 380
     		     (destructuring-bind (var &optional value supplied-p)
    
    377 381
     			 var
    
    378 382
     		       (declare (ignore value))
    
    379 383
     		       (if (consp var)
    
    380
    -			   (check-var (cadr var) allow-repeated-lambda-vars)
    
    381
    -			   (check-var var allow-repeated-lambda-vars))
    
    384
    +			   (check-var (cadr var))
    
    385
    +			   (check-var var))
    
    382 386
     		       (when supplied-p
    
    383
    -			 (check-var supplied-p allow-repeated-lambda-vars)))
    
    387
    +			 (check-var supplied-p)))
    
    384 388
     		     (check-var var))))
    
    385 389
     	(mapc #'check-required required)
    
    386 390
     	(mapc #'check-optional optional)
    
    387 391
     	(mapc #'check-optional keys)
    
    388 392
     	(when restp (check-var rest))
    
    389
    -	(mapc #'(lambda (v)
    
    390
    -		  ;; Aux variables in DEFMETHODs can, of course, have
    
    391
    -		  ;; repeated lambda vars, just like DEFUN allows
    
    392
    -		  ;; them.
    
    393
    -		  (check-optional v t))
    
    394
    -	      aux)
    
    393
    +	(mapc #'check-aux aux)
    
    395 394
     	(values required optional restp rest keyp keys
    
    396 395
     		allow-other-keys-p aux)))))
    
    397 396