On Mon, 23 Sep 2019, Markus Elfring wrote: > Hello, > > The following small script for the semantic patch language > can point various source code places out for further considerations. > > @replacement@ > expression x; > identifier rc; Add: local idexpression lrc; > @@ > -rc = x; Replace by - lrc@rc = x; julia > return > - rc > + x > ; > > @deletion@ > identifier replacement.rc; > type t; > @@ > -t rc; > ... when != rc > > > Unfortunately, this source code transformation approach seems to be > too generic. Places will be suggested for a change which should > be kept untouched. > > The replacement of assignments should be restricted to local variables. > I guess that the metavariable type “local idexpression” should work > for this purpose. > But I got the impression that its use triggers design challenges > for the removal of a variable by an inherited metavariable in the > second SmPL rule. > Which adjustments should be taken better into account for this use case? > > Regards, > Markus > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >