diff options
| author | Matthieu Sozeau | 2015-10-30 11:48:40 -0400 |
|---|---|---|
| committer | Matthieu Sozeau | 2015-10-30 12:06:14 -0400 |
| commit | 77cf18eb844b45776b2ec67be9f71e8dd4ca002c (patch) | |
| tree | ebdb8d21dbe412505e99985b4afef9078802b3a0 /stm | |
| parent | 8d99e4bf4c54e9eabb0910740f79375ff399b844 (diff) | |
Add a way to get the right fix_exn in external vernacular commands
involving Futures.
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/stm.ml | 8 | ||||
| -rw-r--r-- | stm/stm.mli | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/stm/stm.ml b/stm/stm.ml index 02361c738d..42be4fca71 100644 --- a/stm/stm.ml +++ b/stm/stm.ml @@ -596,6 +596,7 @@ module State : sig ?safe_id:Stateid.t -> ?redefine:bool -> ?cache:Summary.marshallable -> ?feedback_processed:bool -> (unit -> unit) -> Stateid.t -> unit + val fix_exn_ref : (iexn -> iexn) ref val install_cached : Stateid.t -> unit val is_cached : ?cache:Summary.marshallable -> Stateid.t -> bool @@ -619,6 +620,7 @@ end = struct (* {{{ *) (* cur_id holds Stateid.dummy in case the last attempt to define a state * failed, so the global state may contain garbage *) let cur_id = ref Stateid.dummy + let fix_exn_ref = ref (fun x -> x) (* helpers *) let freeze_global_state marshallable = @@ -726,8 +728,10 @@ end = struct (* {{{ *) try prerr_endline("defining "^str_id^" (cache="^ if cache = `Yes then "Y)" else if cache = `Shallow then "S)" else "N)"); - (* set id and good id *) + let good_id = match safe_id with None -> !cur_id | Some id -> id in + fix_exn_ref := exn_on id ~valid:good_id; f (); + fix_exn_ref := (fun x -> x); if cache = `Yes then freeze `No id else if cache = `Shallow then freeze `Shallow id; prerr_endline ("setting cur id to "^str_id); @@ -2559,5 +2563,5 @@ let process_error_hook = Hooks.process_error_hook let interp_hook = Hooks.interp_hook let with_fail_hook = Hooks.with_fail_hook let unreachable_state_hook = Hooks.unreachable_state_hook - +let get_fix_exn () = !State.fix_exn_ref (* vim:set foldmethod=marker: *) diff --git a/stm/stm.mli b/stm/stm.mli index 18ed6fc2e8..0c05c93d4d 100644 --- a/stm/stm.mli +++ b/stm/stm.mli @@ -136,3 +136,4 @@ val process_error_hook : Future.fix_exn Hook.t val interp_hook : (?verbosely:bool -> ?proof:Proof_global.closed_proof -> Loc.t * Vernacexpr.vernac_expr -> unit) Hook.t val with_fail_hook : (bool -> (unit -> unit) -> unit) Hook.t +val get_fix_exn : unit -> (Exninfo.iexn -> Exninfo.iexn) |
