jaredly / jaredly/example-reason-codemod

Detect a function of a given module?

Ouverte
#1 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
OCaml
Étoiles
3
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Examinez les utilitaires de codemod et l’exemple, puis étudiez la manière dont Pexp_ident et getExprType traitent des appels tels que Js.Array.map et un map provenant d’un module ouvert. Comparez si les informations de syntaxe et de type disponibles permettent d’identifier précisément la fonction appelée. Le travail est terminé lorsqu’une approche de détection fiable, ou la limitation qui l’empêche, est documentée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
ocaml
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
20/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.