improve expansion of some unit forms to limit expansion size
Merge to 5.0 original commit: c3fdf47cc7052a617913f45153f6b75fbe1ce6da
This commit is contained in:
commit
7ad10fe4d0
|
@ -8,7 +8,7 @@
|
|||
(provide/contract
|
||||
[current-date (-> date?)]
|
||||
[date->seconds (date? . -> . exact-integer?)]
|
||||
[date->string ((date?) (boolean?) . ->* . string?)]
|
||||
[date->string ((date?) (any/c) . ->* . string?)]
|
||||
[date-display-format (parameter/c (symbols 'american 'chinese 'german 'indian 'irish 'julian 'iso-8601 'rfc2822))]
|
||||
[find-seconds ((integer-in 0 61)
|
||||
(integer-in 0 59)
|
||||
|
|
|
@ -546,22 +546,30 @@
|
|||
|
||||
;; build-val+macro-defs : sig -> (list syntax-object^3)
|
||||
(define-for-syntax (build-val+macro-defs sig)
|
||||
(with-syntax ([(((int-ivar . ext-ivar) ...)
|
||||
((((int-vid . ext-vid) ...) . vbody) ...)
|
||||
((((int-sid . ext-sid) ...) . sbody) ...)
|
||||
_
|
||||
_)
|
||||
(map-sig (lambda (x) x)
|
||||
(make-syntax-introducer)
|
||||
sig)])
|
||||
(list
|
||||
#'((ext-ivar ... ext-vid ... ... ext-sid ... ...)
|
||||
(values
|
||||
(make-rename-transformer (quote-syntax int-ivar)) ...
|
||||
(make-rename-transformer (quote-syntax int-vid)) ... ...
|
||||
(make-rename-transformer (quote-syntax int-sid)) ... ...))
|
||||
#'(((int-sid ...) sbody) ...)
|
||||
#'(((int-vid ...) vbody) ...))))
|
||||
(if (and (null? (cadr sig))
|
||||
(null? (caddr sig)))
|
||||
;; No renames needed; this shortcut avoids
|
||||
;; an explosion of renamings, especially with chains
|
||||
;; of `open':
|
||||
(list #'(() (values)) #'() #'())
|
||||
;; Renames and macros needes:
|
||||
(with-syntax ([(((int-ivar . ext-ivar) ...)
|
||||
((((int-vid . ext-vid) ...) . vbody) ...)
|
||||
((((int-sid . ext-sid) ...) . sbody) ...)
|
||||
_
|
||||
_)
|
||||
(map-sig (lambda (x) x)
|
||||
(make-syntax-introducer)
|
||||
sig)])
|
||||
(list
|
||||
#'((ext-ivar ... ext-vid ... ... ext-sid ... ...)
|
||||
(make-rename-transformers
|
||||
(quote-syntax
|
||||
(int-ivar ...
|
||||
int-vid ... ...
|
||||
int-sid ... ...))))
|
||||
#'(((int-sid ...) sbody) ...)
|
||||
#'(((int-vid ...) vbody) ...)))))
|
||||
|
||||
;; build-post-val-defs : sig -> (list syntax-object)
|
||||
(define-for-syntax (build-post-val-defs sig)
|
||||
|
@ -575,12 +583,24 @@
|
|||
sig)])
|
||||
(list
|
||||
#'((ext-ivar ... ext-vid ... ... ext-sid ... ...)
|
||||
(values
|
||||
(make-rename-transformer (quote-syntax int-ivar)) ...
|
||||
(make-rename-transformer (quote-syntax int-vid)) ... ...
|
||||
(make-rename-transformer (quote-syntax int-sid)) ... ...))
|
||||
(make-rename-transformers
|
||||
(quote-syntax
|
||||
(int-ivar ...
|
||||
int-vid ... ...
|
||||
int-sid ... ...))))
|
||||
#'(post-rhs ...))))
|
||||
|
||||
;; Using `make-rename-transformers' helps improve sharing in
|
||||
;; a syntax-quoted list of identifiers, although it risks
|
||||
;; losting certificates as the list is broken apart; since the
|
||||
;; identifiers are bound at the same point that the rename
|
||||
;; transformer is introduced, certificate loss should be ok.
|
||||
(define-for-syntax (make-rename-transformers ids)
|
||||
(apply values
|
||||
(map
|
||||
make-rename-transformer
|
||||
(syntax->list ids))))
|
||||
|
||||
(define-signature-form (open stx)
|
||||
(define (build-sig-elems sig)
|
||||
(map (λ (p c)
|
||||
|
|
Loading…
Reference in New Issue
Block a user