Function: elint-check-let-form

elint-check-let-form is a byte-compiled function defined in elint.el.gz.

Signature

(elint-check-let-form FORM ENV)

Documentation

Lint the let/let* FORM in ENV.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/elint.el.gz
(defun elint-check-let-form (form env)
  "Lint the let/let* FORM in ENV."
  (let ((varlist (cadr form)))
    (if (not varlist)
	(if (> (length form) 2)
	    ;; An empty varlist is not really an error.  Eg some cl macros
	    ;; can expand to such a form.
	    (progn
	      (or (memq 'empty-let elint-ignored-warnings)
		  (elint-warning "Empty varlist in let: %s" form))
	      ;; Lint the body forms
	      (elint-forms (cddr form) env))
	  (elint-error "Malformed let: %s" form)
	  env)
      ;; Check for (let (a (car b)) ...) type of error
      (if (and (= (length varlist) 2)
	       (symbolp (car varlist))
	       (listp (car (cdr varlist)))
	       (fboundp (car (car (cdr varlist)))))
	  (elint-warning "Suspect varlist: %s" form))
      ;; Add variables to environment, and check the init values
      (let ((newenv env))
	(mapc (lambda (s)
		(cond
		 ((symbolp s)
		  (setq newenv (elint-env-add-var newenv s)))
		 ((and (consp s) (<= (length s) 2))
		  (elint-form (cadr s)
			      (if (eq (car form) 'let)
				  env
				newenv))
		  (setq newenv
			(elint-env-add-var newenv (car s))))
		 (t (elint-error
		     "Malformed `let' declaration: %s" s))))
	      varlist)

	;; Lint the body forms
	(elint-forms (cddr form) newenv)))))