summaryrefslogtreecommitdiffstats
path: root/bytecomp
diff options
context:
space:
mode:
Diffstat (limited to 'bytecomp')
-rw-r--r--bytecomp/matching.ml8
-rw-r--r--bytecomp/translcore.ml9
-rw-r--r--bytecomp/translmod.ml8
3 files changed, 3 insertions, 22 deletions
diff --git a/bytecomp/matching.ml b/bytecomp/matching.ml
index 402ac12ad..a464590e4 100644
--- a/bytecomp/matching.ml
+++ b/bytecomp/matching.ml
@@ -2542,13 +2542,7 @@ let compile_matching loc repr handler_fun arg pat_act_list partial =
let partial_function loc () =
(* [Location.get_pos_info] is too expensive *)
- let fname = match loc.Location.loc_start.Lexing.pos_fname with
- | "" -> !Location.input_name
- | x -> x
- in
- let pos = loc.Location.loc_start in
- let line = pos.Lexing.pos_lnum in
- let char = pos.Lexing.pos_cnum - pos.Lexing.pos_bol in
+ let (fname, line, char) = Location.get_pos_info loc.Location.loc_start in
Lprim(Praise, [Lprim(Pmakeblock(0, Immutable),
[transl_path Predef.path_match_failure;
Lconst(Const_block(0,
diff --git a/bytecomp/translcore.ml b/bytecomp/translcore.ml
index 1e68756cd..d784e51ee 100644
--- a/bytecomp/translcore.ml
+++ b/bytecomp/translcore.ml
@@ -531,14 +531,7 @@ let primitive_is_ccall = function
(* Assertions *)
let assert_failed loc =
- (* [Location.get_pos_info] is too expensive *)
- let fname = match loc.Location.loc_start.Lexing.pos_fname with
- | "" -> !Location.input_name
- | x -> x
- in
- let pos = loc.Location.loc_start in
- let line = pos.Lexing.pos_lnum in
- let char = pos.Lexing.pos_cnum - pos.Lexing.pos_bol in
+ let (fname, line, char) = Location.get_pos_info loc.Location.loc_start in
Lprim(Praise, [Lprim(Pmakeblock(0, Immutable),
[transl_path Predef.path_assert_failure;
Lconst(Const_block(0,
diff --git a/bytecomp/translmod.ml b/bytecomp/translmod.ml
index 7f52f99a1..a80fee68f 100644
--- a/bytecomp/translmod.ml
+++ b/bytecomp/translmod.ml
@@ -109,13 +109,7 @@ let mod_prim name =
fatal_error ("Primitive " ^ name ^ " not found.")
let undefined_location loc =
- (* Confer Translcore.assert_failed *)
- let fname = match loc.Location.loc_start.Lexing.pos_fname with
- | "" -> !Location.input_name
- | x -> x in
- let pos = loc.Location.loc_start in
- let line = pos.Lexing.pos_lnum in
- let char = pos.Lexing.pos_cnum - pos.Lexing.pos_bol in
+ let (fname, line, char) = Location.get_pos_info loc.Location.loc_start in
Lconst(Const_block(0,
[Const_base(Const_string fname);
Const_base(Const_int line);