From dee94bbc35912958512ee1841d6f42c74a642d65 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Sun, 19 Nov 2023 23:44:11 +0900 Subject: [PATCH] fix --- contrib/walker/example.lisp | 4 ++++ contrib/walker/loop-form.lisp | 6 +++--- contrib/walker/tests/test-cases.lisp | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/contrib/walker/example.lisp b/contrib/walker/example.lisp index 7ad108e..676c957 100644 --- a/contrib/walker/example.lisp +++ b/contrib/walker/example.lisp @@ -246,3 +246,7 @@ (loop :for x :from 1 :to 10 :if (f x) :do (g x)) + +(loop :for n :in list + :do (f n) + (g n)) diff --git a/contrib/walker/loop-form.lisp b/contrib/walker/loop-form.lisp index 1e4d283..599f35a 100644 --- a/contrib/walker/loop-form.lisp +++ b/contrib/walker/loop-form.lisp @@ -556,13 +556,13 @@ (t nil))) (compound-forms (env) - (let ((pos pos) + (let ((first-pos pos) (exp (next))) (walker-assert (consp exp)) - (cons (walk walker exp env (cons pos path)) + (cons (walk walker exp env (cons first-pos path)) (loop :for exp := (lookahead) :while (consp exp) - :collect (walk walker exp env (cons pos path)) + :collect (walk walker exp env (cons (current) path)) :do (next))))) (compound-forms-with-lazy () (let ((pos pos) diff --git a/contrib/walker/tests/test-cases.lisp b/contrib/walker/tests/test-cases.lisp index 0e00ca3..cf94e19 100644 --- a/contrib/walker/tests/test-cases.lisp +++ b/contrib/walker/tests/test-cases.lisp @@ -3740,3 +3740,18 @@ :COLLECT :IT) (1 6)) ((1 6) (2))) +((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS + (LOOP :FOR MICROS/WALKER::N :IN LIST + :DO (MICROS/WALKER::F MICROS/WALKER::N) (MICROS/WALKER::G MICROS/WALKER::N)) + (1 7)) + ((1 7) (1 6) (2))) +((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS + (LOOP :FOR MICROS/WALKER::N :IN LIST + :DO (MICROS/WALKER::F MICROS/WALKER::N) (MICROS/WALKER::G MICROS/WALKER::N)) + (1 6)) + ((1 7) (1 6) (2))) +((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS + (LOOP :FOR MICROS/WALKER::N :IN LIST + :DO (MICROS/WALKER::F MICROS/WALKER::N) (MICROS/WALKER::G MICROS/WALKER::N)) + (2)) + ((1 7) (1 6) (2)))