I tried the following semantic patches:

@find@
expression action, check, result;
position p;
statement is, es;
@@
 result = action(...);
 if (
(   <+... result ...+>
&   check@p
)   )
    is
 else
    es

@script:ocaml@
action << find.action;
check << find.check;
p << find.p;
@@
Printf.printf "%s %s %s\n" action check (Dumper.dump p)

----------------------------

@find@
expression action, check, result;
position p;
statement is, es;
@@
 result = action(...);
 if@p (
(     <+... result ...+>
&     check
)     )
     is
 else
     es

@script:ocaml@
action << find.action;
check << find.check;
p << find.p;
@@
Printf.printf "%s %s %s\n" action check (Dumper.dump p)

On the code you provided whichis unfortunately much too long to include in
a message and that you could have surely shortened to illustrate whatever
is the problem.

I get the same output from both semantic patches, except that the line
numbers are different for the position variable p, because you have put it
in a different place.

I don't see any reason why making the script code call a database would
have any impact on this issue.

If you do get different results for the above semantic patches, please
make a small .c file that illustrates the problem.  The .c file should be
such that it illustrates the problem and no smaller file also illustrates
the problem.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to