Skip to content

Commit 3caee43

Browse files
committed
Use compare instead of introducing equal
1 parent bda6f34 commit 3caee43

File tree

4 files changed

+1
-17
lines changed

4 files changed

+1
-17
lines changed

src/analysis/destruct.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ let find_field_name_for_punning_field patt = function
489489
List.find_opt ~f:(fun (_, _, opat) ->
490490
let ppat_loc = patt.Typedtree.pat_loc
491491
and opat_loc = opat.Typedtree.pat_loc in
492-
Location_aux.equal ppat_loc opat_loc
492+
Int.equal (Location_aux.compare ppat_loc opat_loc) 0
493493
) fields |> Option.map ~f:(fun (_, label, _) -> label)
494494
| _ -> None
495495

src/ocaml/parsing/location_aux.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ let compare (l1: t) (l2: t) =
3838
| 0 -> Lexing.compare_pos l1.loc_end l2.loc_end
3939
| _ -> assert false
4040

41-
let equal
42-
{ loc_start = start_a; loc_end = end_a; loc_ghost = ghost_a }
43-
{ loc_start = start_b; loc_end = end_b; loc_ghost = ghost_b } =
44-
Lexing.equal_position start_a start_b && Lexing.equal_position end_a end_b &&
45-
Bool.equal ghost_a ghost_b
46-
4741
let compare_pos pos loc =
4842
if Lexing.compare_pos pos loc.Location.loc_start < 0 then
4943
-1

src/ocaml/parsing/location_aux.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ val compare : t -> t -> int
3535

3636
val compare_pos: Lexing.position -> t -> int
3737

38-
(** [equal l1 l2] equality between location *)
39-
val equal : t -> t -> bool
40-
4138
(** Return the smallest location covered by both arguments,
4239
ghost if both are ghosts *)
4340
val union : t -> t -> t

src/utils/std.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,6 @@ module Lexing = struct
549549
include (Lexing : module type of struct include Lexing end
550550
with type position := position)
551551

552-
553-
let equal_position
554-
{ pos_fname = fname_a; pos_lnum = lnum_a; pos_bol = bol_a; pos_cnum = cnum_a }
555-
{ pos_fname = fname_b; pos_lnum = lnum_b; pos_bol = bol_b; pos_cnum = cnum_b } =
556-
String.equal fname_a fname_b && Int.equal lnum_a lnum_b &&
557-
Int.equal bol_a bol_b && Int.equal cnum_a cnum_b
558-
559552
let move buf p =
560553
buf.lex_abs_pos <- (p.pos_cnum - buf.lex_curr_pos);
561554
buf.lex_curr_p <- p

0 commit comments

Comments
 (0)