replace
Tries to replace the old expression with a new one, given the parent.
There are different things to consider:
First, this only works if parent is either an ArgumentHolder or StatementHolder. Otherwise, we cannot instruct the parent to exchange the node
Second, since exchanging the node has influence on their edges (such as EOG, DFG, etc.), we only support a replacement very early in the pass system. To be specific, we only allow replacement BEFORE any DFG edges are set. We are re-wiring EOG edges, but nothing else. If one tries to replace a node with existing Node.nextDFG or Node.prevDFG, we fail.
We also migrate HasType.typeObservers from the old to the new node.
Lastly, if the new node is a CallExpression.callee of a CallExpression parent, and the old and new expressions are of different types (e.g., exchanging a simple Reference for a MemberExpression), we also replace the CallExpression with a MemberCallExpression.