jaredly / jaredly/example-reason-codemod
Detect a function of a given module?
- Vorherrschende Sprache
- OCaml
- Sterne
- 3
- Forks
- 0
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Überprüfe die codemod utils und das Beispiel und untersuche anschließend, wie Pexp_ident und getExprType Aufrufe wie Js.Array.map und ein map aus einem geöffneten Modul behandeln. Vergleiche, ob die verfügbaren Syntax- und Typinformationen die aufgerufene Funktion zuverlässig identifizieren können. Als abgeschlossen gilt die Dokumentation eines zuverlässigen Erkennungsansatzes oder der Einschränkung, die dies verhindert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- ocaml
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100