summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Xu <jay.xu.krfantasy@gmail.com>2021-11-07 20:11:35 +0800
committerJay Xu <jay.xu.krfantasy@gmail.com>2021-11-18 14:45:52 +0800
commit6a675460f896431a3ca933b74f4e8f08a91c0869 (patch)
tree7e3e4c703202bf4c121961c0e2eabdf38ce4ec63
parent578ea8fda533d09776124510c6b962736337e139 (diff)
downloadgeiser-chez-6a675460f896431a3ca933b74f4e8f08a91c0869.tar.gz
geiser-chez-6a675460f896431a3ca933b74f4e8f08a91c0869.tar.bz2
show the parameter list of record type constructors, predicates,
accessors and mutators.
-rw-r--r--src/geiser/geiser.ss13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index afa58c3..6546579 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -101,10 +101,21 @@
(if s
(let ((form (s 'value)))
(if (and (list? form)
- (> (length form) 2))
+ (>= (length form) 2))
(case (car form)
[(lambda) (list (cadr form))]
[(case-lambda) (map car (cdr form))]
+ [(record-predicate record-accessor)
+ (list (list (record-type-name (cadr (cadr form)))))]
+ [(record-mutator)
+ (let ([rtd (cadr (cadr form))]
+ [field-idx (caddr form)])
+ (list (list (record-type-name rtd)
+ (vector-ref (record-type-field-names rtd) field-idx))))]
+ [(record-constructor)
+ (let* ([rcd (cadr (cadr form))]
+ [rtd (((inspect/object rcd) 'ref 'rtd) 'value)])
+ (list (vector->list (record-type-field-names rtd))))]
[else #f])
#f))
#f)))