[Cuis-dev] Fix for Extract Method parameter order
Juan Vuletich
juan at cuis.st
Mon Sep 15 12:46:23 PDT 2025
Integrated. Thanks!
On 10/09/2025 6:38 PM, Nicolás Papagna Maldonado via Cuis-dev wrote:
> Hi folks,
>
> Attached is a fix for the order in which the parameters of the extract
> method refactoring
>
> *Actual behavior*: when extracting a method using the Extract Method
> refactoring, the order of the parameters is non-deterministic.
>
> Trying to extract a + b from the following example multiple times
> might suggest to the user the message keyword1: a keyword2: b or
> keyword1: b keyword2: a randomly.
>
> a := 1.
> b := 2.
> ^ a + b
>
>
> This bug has two causes:
>
> * Encoder>>#initializeCompleteSourceRangesBasedOn: uses a Dictionary
> to store source ranges.
> * Even if this is fixed, Encoder itself uses a Dictionary to store
> source ranges (used in the method above).
>
> This use of Dictionary makes enumeration order non-deterministic.
>
> *Expected behavior*: parameters should be suggested in the order they
> appear in the source code.
>
> *Proposed solution*: the bug was fixed by sorting the parameter nodes
> for the method to be extracted by the position they appear in the
> source code.
>
> Cheers!
> Nico PM
>
>
>
--
Juan Vuletich
www.cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250915/d44e0740/attachment.htm>
More information about the Cuis-dev
mailing list