rescript-association / reanalyze

Experimental analyses for ReScript and OCaml: globally dead values/types, exception analysis, and termination analysis.
MIT License
277 stars 20 forks source link

Use isApply and isRevapply #182

Closed LimitEpsilon closed 2 years ago

LimitEpsilon commented 2 years ago

In the spirit of https://github.com/rescript-association/reanalyze/pull/181, use pattern-matching for figuring out operators @@ and |>.

LimitEpsilon commented 2 years ago

As in the case of raise, since the Pervasives module is deprecated @@ becomes Stdlib.@@. Since reanalyze also supports OCaml exn analysis, I simply wanted a relatively stable way of determining regardless of the module the operators are defined in. For example, https://github.com/janestreet/base/blob/a678184f2c989e8c3a1ecae8b1b46ec51a61bcb3/src/base.ml#L521 defines |> again in the Export module. So using the OCaml bytecode representation, which is relatively stable, seemed for me to be the general solution.