summaryrefslogtreecommitdiff
path: root/lib/compat.ml4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compat.ml4')
-rw-r--r--lib/compat.ml411
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/compat.ml4 b/lib/compat.ml4
index 5e1c65b4..0947f5fb 100644
--- a/lib/compat.ml4
+++ b/lib/compat.ml4
@@ -11,19 +11,24 @@
(* IFDEF not available in 3.06; use ifdef instead *)
(* type loc is different in 3.08 *)
-ifdef OCAML308 then
+ifdef OCAML_308 then
module M = struct
type loc = Token.flocation
let dummy_loc = Token.dummy_loc
-let unloc (b,e) = (b.Lexing.pos_cnum,e.Lexing.pos_cnum)
let make_loc loc = Token.make_loc loc
+let unloc (b,e) =
+ let loc = (b.Lexing.pos_cnum,e.Lexing.pos_cnum) in
+ (* Ensure that we unpack a char location that was encoded as a line-col
+ location by make_loc *)
+ assert (dummy_loc = (b,e) or make_loc loc = (b,e));
+ loc
end
else
module M = struct
type loc = int * int
let dummy_loc = (0,0)
-let unloc x = x
let make_loc x = x
+let unloc x = x
end
type loc = M.loc