diff options
author | Stephane Glondu <steph@glondu.net> | 2012-01-07 17:59:15 +0100 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2012-01-07 18:20:56 +0100 |
commit | 2ee61d5995ef572f0124691f10630305a59b4f73 (patch) | |
tree | eaeffb7be70ce770a822108f8a527312f67fd8b2 /plugins/extraction/common.ml | |
parent | ba021624830c7ad5df0688d144e4305551ae1a5f (diff) | |
parent | de109d8c0c68f569b907e6e24271f259ba28888e (diff) |
Prepare upload to squeeze-backportsdebian/8.3.pl3+dfsg-1_bpo60+1
Diffstat (limited to 'plugins/extraction/common.ml')
-rw-r--r-- | plugins/extraction/common.ml | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/extraction/common.ml b/plugins/extraction/common.ml index 9cea0562..9713fcd2 100644 --- a/plugins/extraction/common.ml +++ b/plugins/extraction/common.ml @@ -1,12 +1,12 @@ (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) -(*i $Id: common.ml 14010 2011-04-15 16:05:07Z letouzey $ i*) +(*i $Id: common.ml 14641 2011-11-06 11:59:10Z herbelin $ i*) open Pp open Util @@ -179,6 +179,16 @@ let mktable autoclean = if autoclean then register_cleanup (fun () -> Hashtbl.clear h); (Hashtbl.add h, Hashtbl.find h, fun () -> Hashtbl.clear h) +(* We might have built [global_reference] whose canonical part is + inaccurate. We must hence compare only the user part, + hence using a Hashtbl might be incorrect *) + +let mktable_ref autoclean = + let m = ref Refmap'.empty in + let clear () = m := Refmap'.empty in + if autoclean then register_cleanup clear; + (fun r v -> m := Refmap'.add r v !m), (fun r -> Refmap'.find r !m), clear + (* A table recording objects in the first level of all MPfile *) let add_mpfiles_content,get_mpfiles_content,clear_mpfiles_content = @@ -355,10 +365,10 @@ let ref_renaming_fun (k,r) = (* Cached version of the last function *) let ref_renaming = - let add,get,_ = mktable true in - fun x -> - try if is_mp_bound (base_mp (modpath_of_r (snd x))) then raise Not_found; get x - with Not_found -> let y = ref_renaming_fun x in add x y; y + let add,get,_ = mktable_ref true in + fun ((k,r) as x) -> + try if is_mp_bound (base_mp (modpath_of_r r)) then raise Not_found; get r + with Not_found -> let y = ref_renaming_fun x in add r y; y (* [visible_clash mp0 (k,s)] checks if [mp0-s] of kind [k] can be printed as [s] in the current context of visible |