Skip to content
Snippets Groups Projects
Commit c961673a authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix issue #1. Handle funcall in compiler macro functions.

Also added tests/issues.lisp with a corresponding test.
parent 48c324f4
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,12 @@
(not (and (listp ,arg-list-name)
(eq 'funcall (car ,arg-list-name)))))
`(progn
(setf ,arg-list-name (cdr ,arg-list-name)))))
(setf ,arg-list-name
;; Handle the case (funcall #'foo args)
(if (consp (second ,arg-list-name))
(list* (second (second ,arg-list-name))
(cddr ,arg-list-name))
(cdr ,arg-list-name))))))
(push-let-binding (car rest-of-args) arg-list-name nil))
((and (cdr rest-of-args) (consp (cadr rest-of-args)))
(pop rest-of-args)
......
;;; Tests from gitlab issues
(defpackage :issues-tests
(:use :cl :lisp-unit))
(in-package "ISSUES-TESTS")
(defun square (x)
(expt x 2))
(define-compiler-macro square (&whole form arg)
(declare (ignore arg))
form)
(define-test issue.1.a
(:tag :issues)
(assert-equal
'(square x)
(funcall (compiler-macro-function 'square) '(square x) nil)))
(define-test issue.1.b
(:tag :issues)
(assert-equal
'(square x)
(funcall (compiler-macro-function 'square) '(funcall #'square x) nil)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment