summaryrefslogtreecommitdiff
path: root/src/tg/method-macros.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tg/method-macros.lisp')
-rw-r--r--src/tg/method-macros.lisp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tg/method-macros.lisp b/src/tg/method-macros.lisp
index 215b2ab..b924e15 100644
--- a/src/tg/method-macros.lisp
+++ b/src/tg/method-macros.lisp
@@ -3,6 +3,7 @@
3(defpackage :ukkoclot/tg/method-macros 3(defpackage :ukkoclot/tg/method-macros
4 (:documentation "Macros for easy defining TG methods.") 4 (:documentation "Macros for easy defining TG methods.")
5 (:use :c2cl :iterate) 5 (:use :c2cl :iterate)
6 (:import-from :alexandria :with-gensyms)
6 (:import-from :com.dieggsy.f-string :enable-f-strings) 7 (:import-from :com.dieggsy.f-string :enable-f-strings)
7 (:import-from :serapeum :take) 8 (:import-from :serapeum :take)
8 (:import-from :ukkoclot/state :bot) 9 (:import-from :ukkoclot/state :bot)
@@ -51,13 +52,11 @@
51 `(,(param-name param) ,(param-default param))) 52 `(,(param-name param) ,(param-default param)))
52 53
53 (defun emit-defun (name return-type params method) 54 (defun emit-defun (name return-type params method)
54 (let ((revparams (reverse params)) 55 (with-gensyms (args bot)
55 (args (gensym "ARGS"))
56 (bot (gensym "BOT")))
57 `(defun ,name (,bot &key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid 56 `(defun ,name (,bot &key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid
58 (collect (emit-defun-arg param)))) 57 (collect (emit-defun-arg param))))
59 (let (,args) 58 (let (,args)
60 ,@(iter (for param in revparams) 59 ,@(iter (for param in (reverse params))
61 (collect (if (param-skip-if-default param) 60 (collect (if (param-skip-if-default param)
62 `(unless (equal ,(param-name param) 61 `(unless (equal ,(param-name param)
63 ,(param-default param)) 62 ,(param-default param))