diff options
| author | 2025-10-18 03:06:09 +0300 | |
|---|---|---|
| committer | 2025-10-18 03:53:48 +0300 | |
| commit | ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae (patch) | |
| tree | 5dcc03e76b14f1bb522f16ea98e975a7ef5bbb88 /src/tg/type-macros.lisp | |
| parent | Add "tiny ..." trigger (diff) | |
| download | ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.tar.gz ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.tar.xz ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.zip | |
Add ocicl lint
Diffstat (limited to 'src/tg/type-macros.lisp')
| -rw-r--r-- | src/tg/type-macros.lisp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tg/type-macros.lisp b/src/tg/type-macros.lisp index 552c908..b9d649c 100644 --- a/src/tg/type-macros.lisp +++ b/src/tg/type-macros.lisp | |||
| @@ -15,7 +15,10 @@ | |||
| 15 | 15 | ||
| 16 | (defparameter +unique+ (gensym)) | 16 | (defparameter +unique+ (gensym)) |
| 17 | 17 | ||
| 18 | (defun make-field (name type &optional (default +unique+) &key (skip-if-default (not (eq default +unique+)))) | 18 | ;; TODO: Fix optional-and-key ! |
| 19 | (defun make-field (name type ; lint:suppress avoid-optional-and-key | ||
| 20 | &optional (default +unique+) | ||
| 21 | &key (skip-if-default (not (eq default +unique+)))) | ||
| 19 | (let ((default (if (eq default +unique+) | 22 | (let ((default (if (eq default +unique+) |
| 20 | `(error ,(format nil "No value given for ~A" name)) | 23 | `(error ,(format nil "No value given for ~A" name)) |
| 21 | default))) | 24 | default))) |
| @@ -70,7 +73,7 @@ | |||
| 70 | ,@(emit-collect-nondefault-fields | 73 | ,@(emit-collect-nondefault-fields |
| 71 | name fields obj | 74 | name fields obj |
| 72 | (lambda (field value) | 75 | (lambda (field value) |
| 73 | `(setf ,result (cons ,(emit-coerced-field field value) ,result)))) | 76 | `(push ,(emit-coerced-field field value) ,result))) |
| 74 | ,result)))) | 77 | ,result)))) |
| 75 | 78 | ||
| 76 | (defun emit-let-gethash (field source) | 79 | (defun emit-let-gethash (field source) |
| @@ -81,8 +84,8 @@ | |||
| 81 | (let ((type-sym (gensym "TYPE-SYM")) | 84 | (let ((type-sym (gensym "TYPE-SYM")) |
| 82 | (source (gensym "SOURCE"))) | 85 | (source (gensym "SOURCE"))) |
| 83 | `(defmethod parse-value ((,type-sym (eql ',name)) ,source) | 86 | `(defmethod parse-value ((,type-sym (eql ',name)) ,source) |
| 84 | (let ,(iter (for field in fields) | 87 | (let (,@(iter (for field in fields) |
| 85 | (collect (emit-let-gethash field source))) | 88 | (collect (emit-let-gethash field source)))) |
| 86 | (,(type-constructor name) | 89 | (,(type-constructor name) |
| 87 | ,@(iter (for field in fields) | 90 | ,@(iter (for field in fields) |
| 88 | (appending (emit-constructor-args field)))))))) | 91 | (appending (emit-constructor-args field)))))))) |
| @@ -92,7 +95,7 @@ | |||
| 92 | (stream (gensym "STREAM")) | 95 | (stream (gensym "STREAM")) |
| 93 | (depth (gensym "DEPTH")) | 96 | (depth (gensym "DEPTH")) |
| 94 | (pprint-args (gensym "PPRINT-ARGS"))) | 97 | (pprint-args (gensym "PPRINT-ARGS"))) |
| 95 | `(defun ,printer-name (,obj ,stream ,depth) | 98 | `(defun ,printer-name (,obj ,stream ,depth) ; lint:suppress lambda-list-invalid |
| 96 | (declare (ignore ,depth)) | 99 | (declare (ignore ,depth)) |
| 97 | (let (,pprint-args) | 100 | (let (,pprint-args) |
| 98 | ,@(emit-collect-nondefault-fields | 101 | ,@(emit-collect-nondefault-fields |