Commit | Line | Data |
---|---|---|
34e49164 C |
1 | open Common |
2 | ||
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) | |
7 | ||
8 | * Maybe would be easier to transform ast_c in ast_cocci and call the | |
9 | * iso engine of julia. *) | |
10 | ||
11 | open Ast_c | |
12 | ||
13 | let rec (iso_e_e: expression -> expression -> bool) = fun a b -> | |
14 | raise Todo | |
15 | (* | |
16 | let rec (=~=) a b = | |
17 | match (a, b) with | |
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) -> | |
21 | ea =~= eb && | |
22 | List.length eas = List.length ebs && | |
23 | List.for_all (fun (a, b) -> | |
24 | match (a, b) with | |
25 | | (Left ea, iia), (Left eb, iib) -> ea =~= eb | |
26 | | _ -> raise Todo | |
27 | ) | |
28 | (zip eas ebs) | |
29 | | (Binary (ea1,Logical AndLog,ea2),typa, iia), (Binary (eb1,Logical AndLog, eb2), typb, iib) -> | |
30 | (ea1 =~= eb1 && ea2 =~= eb2) | |
31 | || | |
32 | (ea1 =~= eb2 && ea2 =~= eb1) | |
33 | ||
34 | | _ -> raise Todo | |
35 | in | |
36 | a =~= b | |
37 | *) | |
38 | ||
39 | and (iso_st_st: statement -> statement -> bool) = fun a b -> | |
40 | raise Todo | |
41 | and (iso_t_t: fullType -> fullType -> bool) = fun a b -> | |
42 | raise Todo | |
43 | ||
44 | ||
45 | (* | |
46 | let _ = assert (iso_e_e | |
47 | (cexpression_of_string "a&&b") | |
48 | (cexpression_of_string "b&&a") | |
49 | *) | |
50 |