diff options
Diffstat (limited to 'src/tg/method-macros.lisp')
| -rw-r--r-- | src/tg/method-macros.lisp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tg/method-macros.lisp b/src/tg/method-macros.lisp index 00adf95..56445e3 100644 --- a/src/tg/method-macros.lisp +++ b/src/tg/method-macros.lisp | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | (:import-from :alexandria :with-gensyms) | 6 | (:import-from :alexandria :with-gensyms) |
| 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) | 7 | (:import-from :com.dieggsy.f-string :enable-f-strings) |
| 8 | (:import-from :serapeum :take) | 8 | (:import-from :serapeum :take) |
| 9 | (:import-from :state) | ||
| 9 | (:import-from :str) | 10 | (:import-from :str) |
| 10 | (:import-from :ukkoclot/src/state :bot) | ||
| 11 | (:import-from :ukkoclot/src/transport :do-call) | 11 | (:import-from :ukkoclot/src/transport :do-call) |
| 12 | (:export :define-tg-method)) | 12 | (:export :define-tg-method)) |
| 13 | (in-package :ukkoclot/src/tg/method-macros) | 13 | (in-package :ukkoclot/src/tg/method-macros) |
| @@ -53,9 +53,9 @@ | |||
| 53 | `(,(param-name param) ,(param-default param))) | 53 | `(,(param-name param) ,(param-default param))) |
| 54 | 54 | ||
| 55 | (defun emit-defun (name return-type params method) | 55 | (defun emit-defun (name return-type params method) |
| 56 | (with-gensyms (args bot) | 56 | (with-gensyms (args) |
| 57 | `(defun ,name (,bot &key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid | 57 | `(defun ,name (&key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid |
| 58 | (collect (emit-defun-arg param)))) | 58 | (collect (emit-defun-arg param)))) |
| 59 | (let (,args) | 59 | (let (,args) |
| 60 | ,@(iter (for param in (reverse params)) | 60 | ,@(iter (for param in (reverse params)) |
| 61 | (collect (if (param-skip-if-default param) | 61 | (collect (if (param-skip-if-default param) |
| @@ -63,11 +63,11 @@ | |||
| 63 | ,(param-default param)) | 63 | ,(param-default param)) |
| 64 | ,(emit-append-to-args param args)) | 64 | ,(emit-append-to-args param args)) |
| 65 | (emit-append-to-args param args)))) | 65 | (emit-append-to-args param args)))) |
| 66 | (do-call ,bot ,method ,(path-from-name name) ',return-type ,args))))) | 66 | (do-call ,method ,(path-from-name name) ',return-type ,args))))) |
| 67 | 67 | ||
| 68 | (defun emit-ftype (name return-type params) | 68 | (defun emit-ftype (name return-type params) |
| 69 | `(declaim (ftype (function (bot &key ,@(iter (for param in params) | 69 | `(declaim (ftype (function (&key ,@(iter (for param in params) |
| 70 | (collect (emit-arg-type param)))) | 70 | (collect (emit-arg-type param)))) |
| 71 | ,return-type) | 71 | ,return-type) |
| 72 | ,name)))) | 72 | ,name)))) |
| 73 | 73 | ||