diff options
| author | Pierre-Marie Pédrot | 2015-12-27 00:44:58 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2015-12-27 01:24:35 +0100 |
| commit | 77e6eda6388aba117476f6c8445c4b61ebdbc33e (patch) | |
| tree | f86480d946fe24e3b34358c0711660ba466501a6 /tactics/tacinterp.ml | |
| parent | 223db63e09d3f4b0e779961918b1fedd5cda511d (diff) | |
Tentative API fix for tactic arguments to be fed to tclWITHHOLES.
The previous implementation was a source of evar leaks if misused, as
it created values coming together with their current evar_map. This is
dead wrong if the value is not used on the spot. To fix this, we rather
return a ['a delayed_open] object.
Two argument types were modified: bindings and constr_bindings. The
open_constr argument should also be fixed, but it is more entangled and
thus I leave it for another commit.
Diffstat (limited to 'tactics/tacinterp.ml')
| -rw-r--r-- | tactics/tacinterp.ml | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tactics/tacinterp.ml b/tactics/tacinterp.ml index d96c8f98a2..16cafafeb8 100644 --- a/tactics/tacinterp.ml +++ b/tactics/tacinterp.ml @@ -2277,13 +2277,15 @@ let () = let lift f = (); fun ist gl x -> (project gl, f ist (pf_env gl) (project gl) x) let lifts f = (); fun ist gl x -> f ist (pf_env gl) (project gl) x -let interp_bindings' ist gl bl = - let (sigma, bl) = interp_bindings ist (pf_env gl) (project gl) bl in - (project gl, pack_sigma (sigma, bl)) - -let interp_constr_with_bindings' ist gl c = - let (sigma, c) = interp_constr_with_bindings ist (pf_env gl) (project gl) c in - (project gl, pack_sigma (sigma, c)) +let interp_bindings' ist gl bl = (project gl, { delayed = fun env sigma -> + let (sigma, bl) = interp_bindings ist env (Sigma.to_evar_map sigma) bl in + Sigma.Unsafe.of_pair (bl, sigma) + }) + +let interp_constr_with_bindings' ist gl c = (project gl, { delayed = fun env sigma -> + let (sigma, c) = interp_constr_with_bindings ist env (Sigma.to_evar_map sigma) c in + Sigma.Unsafe.of_pair (c, sigma) + }) let () = Geninterp.register_interp0 wit_int_or_var (fun ist gl n -> project gl, interp_int_or_var ist n); |
