Feature Request - Inline Variable

Inline variable works great when there is only one initialization, but it
fails miserably when there are multiple initializations of the same variable
with single uses of the same variable. As an example, I have this code:

Point point = new Point(0, 0);
this.Location = point;
point = new Point(1, 1);
this.Label.Location = point;
point = new Point(2, 2);
this.TextBox.Location = point;

What I would like to have happen is for inline variable to pull up the last
write usage until no further write usages exist and then to wipe out the
temporary variable.


1 comment
Comment actions Permalink

Oh, I forgot to mention that there apparently is a bug in ReSharper 3.0
regarding inline variable. Take this code as a simple example:

// Use either of these initializers
string s = "";
string s = null;
DoSomething(var1, var2, s, var3);

Put the cursor over s and attempt to inline variable. ReSharper complains
(incorrectly) that "Variable s doesn't have initializer." It should inline
either the empty string or null as appropriate.

"Lothan" <lothan@newsguy.com> wrote in message
news:fjv9uu$1j8$1@is.intellij.net...

Inline variable works great when there is only one initialization, but it
fails miserably when there are multiple initializations of the same
variable with single uses of the same variable. As an example, I have this
code:

>

Point point = new Point(0, 0);
this.Location = point;
point = new Point(1, 1);
this.Label.Location = point;
point = new Point(2, 2);
this.TextBox.Location = point;

>

What I would like to have happen is for inline variable to pull up the
last write usage until no further write usages exist and then to wipe out
the temporary variable.

>

0

Please sign in to leave a comment.