3 (* When in a semantic patch there is f(X) ... f(X) we want to force
4 * the two X to be equal in the concrete code, but we would like that
5 * there be equal modulo some isomorphisms, so that the following
6 * concrete code also match: f(a && b) g(); f(b && a)
8 * Maybe would be easier to transform ast_c in ast_cocci and call the
9 * iso engine of julia. *)
13 let rec (iso_e_e
: expression
-> expression
-> bool) = fun a b
->
18 | (Ident a, typa, iia), (Ident b, typb, iib) -> a = b
19 | (Constant a, typa, iia), (Constant b, typb, iib) -> a = b
20 | (FunCall (ea, eas), typa, iia), (FunCall (eb, ebs), typb, iib) ->
22 List.length eas = List.length ebs &&
23 List.for_all (fun (a, b) ->
25 | (Left ea, iia), (Left eb, iib) -> ea =~= eb
29 | (Binary (ea1,Logical AndLog,ea2),typa, iia), (Binary (eb1,Logical AndLog, eb2), typb, iib) ->
30 (ea1 =~= eb1 && ea2 =~= eb2)
32 (ea1 =~= eb2 && ea2 =~= eb1)
39 and (iso_st_st
: statement
-> statement
-> bool) = fun a b
->
41 and (iso_t_t
: fullType
-> fullType
-> bool) = fun a b
->
46 let _ = assert (iso_e_e
47 (cexpression_of_string "a&&b")
48 (cexpression_of_string "b&&a")