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 value_description for figuring out raise #181

Closed LimitEpsilon closed 2 years ago

LimitEpsilon commented 2 years ago

The original code matched the name of the function to possible names of "raise functions" to figure out if the "apply expression" is actually a "raise expression".

This is undesirable, as various versions of OCaml has different names for raise. For example, "Pervasives.raise" now translates to "Stdlib!.Pervasives.raise".

This commit utilizes the value_description field to figure out if the function is a "raise" or not. This pattern-matching format is also utilized in OCaml's typecore.ml : https://github.com/ocaml/ocaml/blob/98392895940cc1c18534280ae001b70fa5bf24c2/typing/typecore.ml#L2358

cristianoc commented 2 years ago

Thanks for this. The only question is how far back this goes. Let's see what CI tests have to say.

cristianoc commented 2 years ago

CI looks happy.