From 6ff305fe0a9925f221eed4e758a1b024989399b2 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Tue, 7 Nov 2023 00:33:31 +0900 Subject: [PATCH] fix defun form and add test cases --- contrib/walker/tests.lisp | 8 +++++++- contrib/walker/walker.lisp | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/walker/tests.lisp b/contrib/walker/tests.lisp index a8b870d..0c066ab 100644 --- a/contrib/walker/tests.lisp +++ b/contrib/walker/tests.lisp @@ -1677,7 +1677,13 @@ (BLOCK FOO (RETURN-FROM FOO 20) (RETURN-FROM FOO 30)) (RETURN-FROM FOO 40)) (1)) - ((1 4) (1 2) (1))))) + ((1 4) (1 2) (1))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (6)) ((6) (4) (1 2))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (5)) ((5) (3) (0 2))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (4)) ((6) (4) (1 2))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (3)) ((5) (3) (0 2))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (1 2)) ((6) (4) (1 2))) + ((MICROS/WALKER:COLLECT-HIGHLIGHT-PATHS (DEFUN F (X Y) X Y X Y) (0 2)) ((5) (3) (0 2))))) (deftest random (loop :for (act-form expected) :in *test-cases* diff --git a/contrib/walker/walker.lisp b/contrib/walker/walker.lisp index 29d4ada..8ab8f29 100644 --- a/contrib/walker/walker.lisp +++ b/contrib/walker/walker.lisp @@ -104,7 +104,7 @@ ;; ast (defclass ast () ((path :initarg :path - :initform (error "Missing :path") + :initform nil :reader ast-path))) (defgeneric ast-equal (ast1 ast2)) @@ -752,7 +752,6 @@ :name name :lambda-list lambda-list :body (make-instance 'implict-progn-form - :path (cons 3 path) :forms (walk-forms walker body env path 3)) :path (cons 0 path)))))