Skip to content

Commit

Permalink
Match compiler dummy position
Browse files Browse the repository at this point in the history
We match the OCaml compiler's dummy position for default locations
when using `Location.in_file`.

Signed-off-by: Patrick Ferris <[email protected]>
  • Loading branch information
patricoferris committed Nov 26, 2024
1 parent 6b85aae commit fee4f2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/location.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ type t = location = {
}

let in_file name =
let loc = { pos_fname = name; pos_lnum = 1; pos_bol = 0; pos_cnum = -1 } in
(* This position matches the compiler's [dummy_pos]. *)
let loc = { pos_fname = name; pos_lnum = 0; pos_bol = 0; pos_cnum = -1 } in
{ loc_start = loc; loc_end = loc; loc_ghost = true }

let set_filename loc fn =
Expand Down

0 comments on commit fee4f2c

Please sign in to comment.