You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It needs to do quite a bit of work to check that some identifiers are usages of others. Those free-identifier=? checks ought to be easier to write. It might be useful to have a (~usage id) syntax pattern that matches any identifier that's free-identifier=? to #'id. That would let me write the above rule like this:
(define-refactoring-rule hash-ref-set!-to-hash-ref!
#:description "This expression can be replaced with a simpler, equivalent `hash-ref!` expression."
#:literals (hash-ref hash-set! define)
(hash-ref
h:id
k1:pure-expression
(_:lambda-by-any-name
()
(definev:id initializer:value-initializer)
(hash-set! (~usage h) k2:pure-expression (~usage v))
(~usage v)))
#:when (syntax-free-identifier=? #'k1 #'k2)
(hash-ref! h k1 initializer.failure-result-form))
Might be worthwhile to make it match any syntax object that's syntax-free-identifier=? too. This could also help with #379, as ~usage could default to (resyntax-local-phase-level) (or whatever equivalent I come up with) instead of (syntax-local-phase-level) like free-identifier=? does.
The text was updated successfully, but these errors were encountered:
Consider the
hash-ref-set!-to-hash-ref!
rule:It needs to do quite a bit of work to check that some identifiers are usages of others. Those
free-identifier=?
checks ought to be easier to write. It might be useful to have a(~usage id)
syntax pattern that matches any identifier that'sfree-identifier=?
to#'id
. That would let me write the above rule like this:Might be worthwhile to make it match any syntax object that's
syntax-free-identifier=?
too. This could also help with #379, as~usage
could default to(resyntax-local-phase-level)
(or whatever equivalent I come up with) instead of(syntax-local-phase-level)
likefree-identifier=?
does.The text was updated successfully, but these errors were encountered: