jaredly / jaredly/example-reason-codemod

Detect a function of a given module?

Aperta
#1 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
OCaml
Stelle
3
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Thanks for creating these codemod utils and example! 🙂 Really cool.

I'm exploring if I could use this codemod for the migrations of BuckleScript `Js` modules proposed in https://github.com/BuckleScript/bucklescript/issues/2975. I wonder how I could approach the detection of usages of some specific functions in `Js.X` modules:

If I use syntactic analysis (e.g. use `Pexp_ident` to match against the function names) it might not be effective in all cases, for example the function can be called with `Js.Array.map` or just `map` if the `Js.Array` module has been opened before.

There is `getExprType` which is awesome but it just works at the type level, so I wouldn't know which function has been called, only the type of the expression.

Is there an approach that I'm missing to do this kind of detection in an accurate way?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Esamina le utility di codemod e l’esempio, quindi analizza come Pexp_ident e getExprType gestiscono chiamate come Js.Array.map e un map proveniente da un modulo aperto. Confronta se le informazioni disponibili sulla sintassi e sui tipi consentono di identificare accuratamente la funzione chiamata. Il lavoro è completo quando viene documentato un approccio di rilevamento affidabile oppure il limite che lo impedisce.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ocaml
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.