Commit fa444fb8 authored by Francois Bobot's avatar Francois Bobot
Browse files

filter_trigger : cleaning

parent 5bb5768b
...@@ -19,19 +19,20 @@ ...@@ -19,19 +19,20 @@
open Term open Term
let rec rt keep t = t_map (rt keep) (rf keep) t let make_rt_rf keep =
let rec rt t = t_map rt rf t
and rf keep f = and rf f =
let f = f_map (rt keep) (rf keep) f in let f = f_map rt rf f in
match f.f_node with match f.f_node with
| Fquant (Fforall,fq) -> | Fquant (Fforall,fq) ->
let vsl,trl,f2 = f_open_quant fq in let vsl,trl,f2 = f_open_quant fq in
let one_false = ref false in let one_false = ref false in
let keep x = let b = keep x in let keep x = let b = keep x in
if b then b else (one_false := true; b) in if b then b else (one_false := true; b) in
let trl = List.filter (List.for_all keep) trl in let trl = List.filter (List.for_all keep) trl in
if not (!one_false) then f else f_forall vsl trl f2 if not (!one_false) then f else f_forall vsl trl f2
| _ -> f | _ -> f in
rt,rf
let keep_no_predicate = function let keep_no_predicate = function
...@@ -41,8 +42,8 @@ let keep_no_predicate = function ...@@ -41,8 +42,8 @@ let keep_no_predicate = function
let filter_trigger_no_predicate = let filter_trigger_no_predicate =
Register.store (fun () -> Register.store (fun () ->
let keep = keep_no_predicate in let rt,rf = make_rt_rf keep_no_predicate in
Trans.rewrite (rt keep) (rf keep) None) Trans.rewrite rt rf None)
let () = Register.register_transform "filter_trigger_no_predicate" let () = Register.register_transform "filter_trigger_no_predicate"
filter_trigger_no_predicate filter_trigger_no_predicate
...@@ -55,7 +56,9 @@ let keep_no_fmla = function ...@@ -55,7 +56,9 @@ let keep_no_fmla = function
let filter_trigger = Register.store let filter_trigger = Register.store
(fun () -> Trans.rewrite (rt keep_no_fmla) (rf keep_no_fmla) None) (fun () ->
let rt,rf = make_rt_rf keep_no_fmla in
Trans.rewrite rt rf None)
let () = Register.register_transform "filter_trigger" filter_trigger let () = Register.register_transform "filter_trigger" filter_trigger
...@@ -69,8 +72,8 @@ let keep_no_builtin query = function ...@@ -69,8 +72,8 @@ let keep_no_builtin query = function
let filter_trigger_builtin = let filter_trigger_builtin =
Register.store_query (fun query -> Register.store_query (fun query ->
let keep = keep_no_builtin query in let rt,rf = make_rt_rf (keep_no_builtin query) in
Trans.rewrite (rt keep) (rf keep) None) Trans.rewrite rt rf None)
let () = Register.register_transform "filter_trigger_builtin" let () = Register.register_transform "filter_trigger_builtin"
filter_trigger_builtin filter_trigger_builtin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment