Exists a reverse refactor of the Introduce Parameter refactor?
Answered
I'm wondering is there's a Refactor feature that lets me push an expression into a method, introducing new parameter(s) and deleting the old parameter. It is essentially, the opposite of the introduce parameter feature.
E.g.:
foo(x+y); // my function call
void foo(int p) {
}
----
I want to select the expression "x + y" and "Push the Expression" into the method I would have:
void foo(int x, y) {
int p = x + y;
}
Please sign in to leave a comment.
Hi,
there is inline parameter refactoring but it would inline the expression x+y instead of p (so there won't be declaration with initializer) and the x and y won't be available at the call side. So looks like the answer is no, there is no such a refactoring. Probably inline parameter could be extended to this when x + y is not a constant expression. Request in youtrack please?
Anna