aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherbelin2004-07-29 15:17:20 +0000
committerherbelin2004-07-29 15:17:20 +0000
commitf970c4054326fa5f66bcfa0e3214b5f7bd137fbc (patch)
tree882a12ef25ccc5284eff35989679c3cb572750c7
parent4c25e3db49f62c15ae3e8a29f60c36020b9b9e46 (diff)
Protection unloc
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@5990 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--lib/compat.ml49
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/compat.ml4 b/lib/compat.ml4
index 6c2102491f..0947f5fb84 100644
--- a/lib/compat.ml4
+++ b/lib/compat.ml4
@@ -15,15 +15,20 @@ 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