It happens very often, while refactoring someone else's code, when you need to simplify the expression for debugging and put the function value into the variable
if (getParent()) {
assert(!getParent()->findChildById(newId) ||| getParent()->findChildById(newId) == this);
Previously, a few years ago, when you selected the first getParent() statement and chose Introduce Variable, the VA offered the choice of
`Replace selection` or `Replace 3 occurencess`, and then I replaced them all to get this:
Node* parent = getParent();
if (parent) {
assert(! parent->findChildById(newId) || parent->findChildById(newId) == this);
This was very handy because I know that my getParent always returns the same value.
Now VA doesn't offer to replace them all, but only one value, and that's annoying.
As a workaround I found a way out, I select only `getParent` without brackets (), and then it replaces them all, but I have to remove extra brackets in the code manually, which is not very convenient.
I would like you to return the ability to cache the return value of functions into a variable.