raco demod: discard unusable macro implementations
Prune away "phase -1" macro registrations, because they're useless, and because the expander's evaluation of linklets now actively rejects them.
This commit is contained in:
parent
4a26420b14
commit
0020332810
|
@ -92,7 +92,14 @@
|
|||
[(closure code gen-id) #t]
|
||||
[(inline-variant direct inline) #t]
|
||||
[(case-lam name clauses) #t]
|
||||
[_ (lam? b)]))
|
||||
[(let-one rhs body type unused?)
|
||||
(and (pure? rhs)
|
||||
(pure? body))]
|
||||
[(seq forms)
|
||||
(for/and ([form (in-list forms)])
|
||||
(pure? form))]
|
||||
[_ (or (lam? b)
|
||||
(void? b))]))
|
||||
|
||||
(for ([b (in-list body)])
|
||||
(match b
|
||||
|
@ -114,7 +121,8 @@
|
|||
(unless (or assume-pure?
|
||||
(pure? rhs))
|
||||
(used-rhs!))]
|
||||
[_ (used! b)]))
|
||||
[_ (unless (pure? b)
|
||||
(used! b))]))
|
||||
|
||||
;; Anything not marked as used at this point can be dropped
|
||||
(define new-internals
|
||||
|
@ -152,7 +160,7 @@
|
|||
[(def-values ids rhs)
|
||||
(for/or ([id (in-list ids)])
|
||||
(eq? 'used (hash-ref used (toplevel-pos id) #f)))]
|
||||
[else (not (void? b))]))
|
||||
[else (not (pure? b))]))
|
||||
b))
|
||||
|
||||
(define new-body (remap-positions used-body
|
||||
|
|
|
@ -120,15 +120,25 @@
|
|||
#:application-hook
|
||||
(lambda (rator rands remap)
|
||||
;; Check for a `(.get-syntax-literal! '<pos>)` call
|
||||
;; or a `(.set-transformer! '<sym> <expr>)` call
|
||||
(cond
|
||||
[(and (toplevel? rator)
|
||||
(let ([i (hash-ref pos-to-name/import (toplevel-pos rator))])
|
||||
(and (import? i)
|
||||
(eqv? syntax-literals-pos (import-pos i)))))
|
||||
;; This is a `(.get-syntax-literal! '<pos>)` call
|
||||
(application (remap rator)
|
||||
;; To support syntax objects, change the offset
|
||||
rands)]
|
||||
i)))
|
||||
=> (lambda (i)
|
||||
(cond
|
||||
[(and any-syntax-literals?
|
||||
(eqv? syntax-literals-pos (import-pos i)))
|
||||
;; This is a `(.get-syntax-literal! '<pos>)` call
|
||||
(application (remap rator)
|
||||
;; To support syntax objects, change the offset
|
||||
rands)]
|
||||
[(and any-transformer-registers?
|
||||
(eqv? transformer-register-pos (import-pos i)))
|
||||
;; This is a `(.set-transformer! '<sym> <expr>)` call
|
||||
(void)]
|
||||
[else #f]))]
|
||||
[else #f]))))))
|
||||
|
||||
(values body
|
||||
|
|
Loading…
Reference in New Issue
Block a user