[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint d0bb526e77 02/17: Faster (nonrecursive) traversa
From: |
ELPA Syncer |
Subject: |
[elpa] externals/relint d0bb526e77 02/17: Faster (nonrecursive) traversal of let* bindings |
Date: |
Thu, 1 Aug 2024 12:58:57 -0400 (EDT) |
branch: externals/relint
commit d0bb526e77b1d8040c3bc0c7dd036fb7a1b52f74
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>
Faster (nonrecursive) traversal of let* bindings
---
relint.el | 40 ++++++++++------------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/relint.el b/relint.el
index a60c4652c2..5f4e8d67cd 100644
--- a/relint.el
+++ b/relint.el
@@ -1878,25 +1878,6 @@ return (NAME); on syntax error, return nil."
nil
val))))))
-(defun relint--check-let* (bindings body mutables pos path index)
- "Check the BINDINGS and BODY of a `let*' form."
- (if bindings
- (let ((b (relint--check-and-eval-let-binding
- (car bindings) mutables pos (cons index (cons 1 path)))))
- (if b
- (let ((relint--locals (cons b relint--locals)))
- (relint--check-let* (cdr bindings) body (cons (car b) mutables)
- pos path (1+ index)))
- (relint--check-let* (cdr bindings) body mutables
- pos path (1+ index))))
- (let ((index 2))
- (while (consp body)
- (when (consp (car body))
- (relint--check-form-recursively-2
- (car body) mutables pos (cons index path)))
- (setq body (cdr body))
- (setq index (1+ index))))))
-
(defun relint--check-form-recursively-2 (form mutables pos path)
"Check FORM (at POS, PATH) recursively.
MUTABLES is a list of lexical variables in a scope which FORM may mutate
@@ -1914,35 +1895,34 @@ directly."
(setq form (cdr form))
(setq index (1+ index)))))
;; now we can assume that `args' is a proper list
- ((eq head 'let)
+ ((memq head '(let let*))
(let ((bindings (car args)))
(when (listp bindings)
- (let* ((body (cdr args))
+ (let* ((relint--locals relint--locals)
+ (new-bindings nil)
+ (let* (eq head 'let*))
(i 0)
(bindings-path (cons 1 path))
- (new-bindings nil)
(body-mutables mutables))
(while (consp bindings)
(let ((b (relint--check-and-eval-let-binding
(car bindings) mutables pos (cons i bindings-path))))
(when b
- (push b new-bindings)
+ (push b (if let* relint--locals new-bindings))
(push (car b) body-mutables))
(setq i (1+ i))
(setq bindings (cdr bindings))))
- (let ((relint--locals
- (append new-bindings relint--locals))
- (index 2))
+ (when new-bindings
+ (setq relint--locals (append (nreverse new-bindings)
+ relint--locals)))
+ (let ((index 2)
+ (body (cdr args)))
(while body
(when (consp (car body))
(relint--check-form-recursively-2
(car body) body-mutables pos (cons index path)))
(setq body (cdr body))
(setq index (1+ index))))))))
- ((eq head 'let*)
- (let ((bindings (car args)))
- (when (listp bindings)
- (relint--check-let* bindings (cdr args) mutables pos path 0))))
((memq head '(setq setq-local))
;; Only mutate lexical variables in the mutation list, which means
;; that this form will be executed exactly once during their remaining
- [elpa] externals/relint updated (9cb20f89ce -> 38c0468a05), ELPA Syncer, 2024/08/01
- [elpa] externals/relint d0bb526e77 02/17: Faster (nonrecursive) traversal of let* bindings,
ELPA Syncer <=
- [elpa] externals/relint 89e15852b1 01/17: Move version history to separate NEWS file, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 7abad19169 03/17: Adapt to xr changes: ranged diagnostics with severity field, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 61724881c3 10/17: Use a defstruct for diag objects instead of raw vectors, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 38c0468a05 17/17: Github CI: ignore changes to NEWS in actions, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 35a2bc31c8 11/17: Simplify: remove expr-pos from diag object, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 458a920b46 06/17: Use a vector instead of list for complaint tuple, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 79ba1f0183 14/17: Require Emacs 27 or newer, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 8cd09d69ae 16/17: NEWS entry for upcoming version 2.0, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 94b23171f0 12/17: Add pos-type field in diag object, ELPA Syncer, 2024/08/01
- [elpa] externals/relint 5c63370936 04/17: Adapt to xr grouped diagnostics, ELPA Syncer, 2024/08/01