Easier way for rules to check identifier usages
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- devtools
Direzione di ricerca
Inizia tracciando il codice di pattern matching delle regole di refactoring e di confronto degli identificatori; l'issue non indica file o test specifici. Definisci cosa significa “completato” per un pattern (~usage id) che fa corrispondere gli utilizzi di free-identifiers, gli utilizzi di syntax-free-identifiers e il default proposto a livello di fase, verificando anche i requisiti correlati in #379.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Consider the hash-ref-set!-to-hash-ref! rule:
(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
h1:id
k1:pure-expression
(_:lambda-by-any-name
()
(define v1:id initializer:value-initializer)
(hash-set! h2:id k2:pure-expression v2:id)
v3:id))
#:when (free-identifier=? #'h1 #'h2)
#:when (syntax-free-identifier=? #'k1 #'k2)
#:when (free-identifier=? #'v1 #'v2)
#:when (free-identifier=? #'v1 #'v3)
(hash-ref! h1 k1 initializer.failure-result-form))
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
()
(define v: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.
- Lingua principale
- Racket
- Stelle
- 70
- Fork
- 11
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jackfirth/resyntax
-
Grimoire docs need examples Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
documentation
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
testing
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
testing
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
-
testing
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
Tutte le issue di jackfirth/resyntax
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
vercel-labs/just-bash#464 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/safe-publish#594 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug feat:crypto feat:utils
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100