Avoid generating definitions for contracts that are identifiers.
This reduces the number of pointless definitions, and re-enables some contract system optimizations.
This commit is contained in:
parent
a0d6ed954d
commit
84d26b91ca
|
@ -145,11 +145,14 @@
|
|||
(and (identifier? ctc-stx)
|
||||
(let ([match? (assoc ctc-stx (hash-values cache) free-identifier=?)])
|
||||
(and match?
|
||||
;; ->* are handled specially by the contract system
|
||||
(let ([sexp (syntax-e (cdr match?))])
|
||||
(and (pair? sexp)
|
||||
(or (free-identifier=? (car sexp) #'->)
|
||||
(free-identifier=? (car sexp) #'->*))))
|
||||
(or
|
||||
;; no need to generate an extra def for things that are already identifiers
|
||||
(identifier? match?)
|
||||
;; ->* are handled specially by the contract system
|
||||
(let ([sexp (syntax-e (cdr match?))])
|
||||
(and (pair? sexp)
|
||||
(or (free-identifier=? (car sexp) #'->)
|
||||
(free-identifier=? (car sexp) #'->*)))))
|
||||
(cdr match?)))))
|
||||
|
||||
;; The below requires are needed since they provide identifiers that
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
(make-contract sc)]
|
||||
[else
|
||||
(define ctc (make-contract sc))
|
||||
(cond [cache
|
||||
(cond [(and (not (identifier? ctc)) cache)
|
||||
(define fresh-id (generate-temporary))
|
||||
(hash-set! cache sc (cons fresh-id ctc))
|
||||
(set! sc-queue (cons sc sc-queue))
|
||||
|
|
Loading…
Reference in New Issue
Block a user