Closed talwrii closed 7 years ago
This also comes up in order to make the arguments that a function take more specific.
c = f(a.b)
d = g(c)
I want to turn this into a function that takes a.b as an argument (rather than a).
To cause this to happen I convert the code to the following
input = a.b
c = f(input)
d = g(c)
And then extract lines 2, and 3
input = a.b
d = new_method(input)
At this point I want / need to inline input again.
This would certainly be nice have. Hopefully I'll get some time soon to work it.
I've added support for rope's inline refactoring in the added-inline
branch. Give it a try and let me know what you think.
If you're using traad via the emacs extension, there's an associated branch in emacs-traad
.
This has only been lightly tested; I wrote it in some free time at an airport, so it was a bit of a rush job.
That was quick, and is quite exciting. Trying this out now.
Let me know if it works for you. If so, I'll merge it into main.
@talwrii Did this work for you?
@talwrii I'm going to assume that this works and merge it in.
This comes up more than one imagines. I have hit this as part of refactoring.
Example:
I want to extract f and g, so I manually change this code to
And then use extract out lines 2 and 3 to get
I then need to incline result in both new_method and here.
Variable inlining is supported in rope. So I imagine it mightn't be too much work to implement.