1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

; elisp-scope.el: Fix 'wrong-type-argument' in local function analyzers

* lisp/emacs-lisp/elisp-scope.el
(elisp-scope--local-function-analyzer): New function.
(elisp-scope-flet, elisp-scope-labels)
(elisp-scope-named-let): Use it.
(elisp-scope-cl-macrolet): Check that argument is
'symbol-with-pos-p' before calling 'symbol-with-pos-pos'.
This commit is contained in:
Eshel Yaron 2025-10-07 23:28:07 +02:00
parent d1d06099d6
commit 61caa91875
No known key found for this signature in database
GPG key ID: EF3EE9CA35D78618

View file

@ -747,12 +747,19 @@ Optional argument LOCAL is a local context to extend."
(elisp-scope-1 (car exps)))
(let ((pos (or beg (cons 'gen (incf elisp-scope-counter)))))
(elisp-scope-with-local-definition bare
(lambda (f &rest args)
(elisp-scope-report 'function (symbol-with-pos-pos f) len pos)
(elisp-scope-n args))
(elisp-scope--local-function-analyzer pos)
(elisp-scope-flet (cdr defs) body outspec))))
(elisp-scope-n body outspec)))
(defun elisp-scope--local-function-analyzer (pos)
(lambda (f &rest args)
(when (symbol-with-pos-p f)
(elisp-scope-report 'function
(symbol-with-pos-pos f)
(length (symbol-name (bare-symbol f)))
pos))
(elisp-scope-n args)))
(defun elisp-scope-labels (defs forms outspec)
(if defs
(let* ((def (car defs))
@ -766,9 +773,7 @@ Optional argument LOCAL is a local context to extend."
(elisp-scope-report 'function beg len beg))
(let ((pos (or beg (cons 'gen (incf elisp-scope-counter)))))
(elisp-scope-with-local-definition bare
(lambda (f &rest args)
(elisp-scope-report 'function (symbol-with-pos-pos f) len pos)
(elisp-scope-n args))
(elisp-scope--local-function-analyzer pos)
(elisp-scope-lambda args body)
(elisp-scope-flet (cdr defs) forms outspec))))
(elisp-scope-n forms outspec)))
@ -1047,12 +1052,9 @@ Optional argument LOCAL is a local context to extend."
(when-let* ((sym (car (ensure-list binding)))
(bare (elisp-scope-sym-bare sym)))
(setq l (elisp-scope-local-new bare (elisp-scope-sym-pos sym) l))))
(let ((pos (or beg (cons 'gen (incf elisp-scope-counter))))
(len (length (symbol-name bare))))
(let ((pos (or beg (cons 'gen (incf elisp-scope-counter)))))
(elisp-scope-with-local-definition bare
(lambda (f &rest args)
(elisp-scope-report 'function (symbol-with-pos-pos f) len pos)
(elisp-scope-n args))
(elisp-scope--local-function-analyzer pos)
(let ((elisp-scope-local-bindings l)) (elisp-scope-n body outspec)))))))
(defun elisp-scope-rx (regexps)
@ -1550,7 +1552,8 @@ Optional argument LOCAL is a local context to extend."
(let ((pos (or beg (cons 'gen (incf elisp-scope-counter)))))
(elisp-scope-with-local-definition bare
(lambda (f &rest _)
(elisp-scope-report 'macro (symbol-with-pos-pos f) len pos))
(when (symbol-with-pos-p f)
(elisp-scope-report 'macro (symbol-with-pos-pos f) len pos)))
(elisp-scope-cl-macrolet (cdr bindings) body outspec))))))
(elisp-scope-n body outspec)))