diff options
| author | herbelin | 2009-04-24 11:06:46 +0000 |
|---|---|---|
| committer | herbelin | 2009-04-24 11:06:46 +0000 |
| commit | ac4ba8bbc899c3d3db1f1f5e0592ee419ed92994 (patch) | |
| tree | 76553bf17254804a0173a023402a064ffd7e2b26 /library | |
| parent | cf71bfb25ddba52c72bdec4507021cd6e5ee06e8 (diff) | |
Backporting 12080 (fixing bug #2091 on bad rollback in the "where"
clause resulting in stray notations for e.g. variable named "le")
and 12083 (fixing bug in as clause of apply in) from trunk.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12103 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library')
| -rw-r--r-- | library/states.ml | 7 | ||||
| -rw-r--r-- | library/states.mli | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/library/states.ml b/library/states.ml index c985dcf2cb..4fbc4c8866 100644 --- a/library/states.ml +++ b/library/states.ml @@ -35,3 +35,10 @@ let with_heavy_rollback f x = f x with reraise -> (unfreeze st; raise reraise) + +let with_state_protection f x = + let st = freeze () in + try + let a = f x in unfreeze st; a + with reraise -> + (unfreeze st; raise reraise) diff --git a/library/states.mli b/library/states.mli index 3deb056585..17f62b5129 100644 --- a/library/states.mli +++ b/library/states.mli @@ -26,4 +26,9 @@ val unfreeze : state -> unit val with_heavy_rollback : ('a -> 'b) -> 'a -> 'b +(*s [with_state_protection f x] applies [f] to [x] and restores the + state of the whole system as it was before the evaluation of f *) + +val with_state_protection : ('a -> 'b) -> 'a -> 'b + |
