aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Scherer2015-06-27 22:01:07 +0200
committerMaxime Dénès2016-06-27 12:45:41 +0200
commit39163205cc59b98028eaaeace86463bb8c990818 (patch)
treeb188a839eb49663dc8fd54cf11ddd750e21a5619 /lib
parentca3226f42346dbbb8e08ab0b6bc3024aecb0cc4a (diff)
minor: in constrintern.ml:sort_fields, clarify build_patt
The code was a big "try..with" defining all useful quantities at once. I tried to lift definitions out of this try..with to define them as early as possible: the record's information and the first field name are fetched before processing the other fields. There were two calls in the try..with body that could raise the Not_found exception (or at least I don't know the code well enough to be sure that either of them cannot): `shortest_qualid_of_global` and `build_patt`. They are now split in two separate try..with blocks, both raising the same exception (with a shared error message named `env_error_msg`). Someone familiar with the invariants at play could probably remove one of the two blocks, streamlining the code even further. I'm a bit surprised by the main logic part (the big (if .. else if .. else if ..) block in the new code), and there is a question in a comment. I hope to get it answered during code review and remove it (and maybe simplify the code). Finally, there was an apparently-stale comment in the code: (* insertion of Constextern.reference_global *) of course Constextern.reference_global corresponds to now function that I could find. After trying to understand the meaning of this comment, I decided to just remove it.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions