[Cuis-dev] TemporaryToInstanceVariable Refactor with Arguments

Eric Brandwein brandweineric at gmail.com
Sun Dec 22 14:45:10 PST 2019


Hi all,

Continuing to the fixes to refactors, here's one for two bugs in
TemporaryToInstanceVariable.
First, the SmalltalkEditor wouldn't check if you were actually extracting a
temporary and not an argument, because both of them are TempVariableNodes.
This means you could try to make the Temporary to Instance Variable
refactor on an argument, and the debugger would pop up.

Second, the TemporaryToInstanceVariable class didn't check if there was
already other block declaring an argument with the same name as the
temporary you were trying to extract, and so when trying to compile the
method without the temporary declaration the Parser would throw an error.
This one can be reproduced by writing this method:

m1
    [ :a | ^a ].
    [ | a | ^a ].

and calling the refactor on the declaration of a on the second block.

Cheers,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191222/89d0f4b9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3984-TemporaryToInstanceVariableWithArgumentsFix-EricBrandwein-2019Dec22-17h06m-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 4498 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191222/89d0f4b9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TemporaryToInstanceVariableWithArgumentsFix-BaseImageTests-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 1805 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191222/89d0f4b9/attachment-0001.bin>


More information about the Cuis-dev mailing list