Move logic of numbering rest/drest arg to abstract results.
original commit: 3c179e021720addc3bd33f98ac1b09a922b25201
This commit is contained in:
parent
4806d40f0e
commit
8238d2a6bd
|
@ -27,14 +27,12 @@
|
|||
(define (lam-result->type lr)
|
||||
(match lr
|
||||
[(struct lam-result ((list (list arg-ids arg-tys) ...) rest drest body))
|
||||
(let ([arg-names (append arg-ids
|
||||
(if rest (list (first rest)) null)
|
||||
(if drest (list (first drest)) null))])
|
||||
(make-arr*
|
||||
arg-tys
|
||||
(abstract-results body arg-names)
|
||||
#:rest (and rest (second rest))
|
||||
#:drest (and drest (second drest))))]))
|
||||
(make-arr*
|
||||
arg-tys
|
||||
(abstract-results body arg-ids
|
||||
#:rest-id (or (and rest (first rest))) (and drest (first drest)))
|
||||
#:rest (and rest (second rest))
|
||||
#:drest (and drest (second drest)))]))
|
||||
|
||||
(define-syntax-class cl-rhs
|
||||
#:literal-sets (kernel-literals)
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
tc-results->values)
|
||||
|
||||
|
||||
(define/cond-contract (abstract-results results arg-names)
|
||||
(tc-results/c (listof identifier?) . -> . SomeValues/c)
|
||||
(define/cond-contract (abstract-results results arg-names #:rest-id [rest-id #f])
|
||||
((tc-results/c (listof identifier?)) (#:rest-id (or/c #f identifier?))
|
||||
. ->* . SomeValues/c)
|
||||
(define arg-names* (append arg-names (if rest-id (list rest-id) null)))
|
||||
(tc-results->values
|
||||
(replace-names
|
||||
(for/list ([(nm k) (in-indexed (in-list arg-names))]) (list nm (make-Path null (list 0 k))))
|
||||
(for/list ([(nm k) (in-indexed (in-list arg-names*))])
|
||||
(list nm (make-Path null (list 0 k))))
|
||||
results)))
|
||||
|
||||
(define (tc-results->values tc)
|
||||
|
|
Loading…
Reference in New Issue
Block a user