if (needResult) {
Node tempVarNode = NodeUtil.newVarNode(tempName, null)
.copyInformationFromForTree(expr);
Node injectionPointParent = injectionPoint.getParent();
injectionPointParent.addChildBefore(tempVarNode, injectionPoint);
injectionPointParent.addChildAfter(ifNode, tempVarNode);
// Replace the expression with the temporary name.
Node replacementValueNode = Node.newString(Token.NAME, tempName);
parent.replaceChild(expr, replacementValueNode);