replace

Tries to replace the old expression with a new one, given the parent.

There are different things to consider: