From f970c4054326fa5f66bcfa0e3214b5f7bd137fbc Mon Sep 17 00:00:00 2001 From: herbelin Date: Thu, 29 Jul 2004 15:17:20 +0000 Subject: Protection unloc git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@5990 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/compat.ml4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3