pharo
pharo copied to clipboard
[RB] Extract method with non local returns breaks
- Given
myMethod
self condition
ifTrue: [ ^ 0 ]
ifFalse: [ ^ 1 ]
- Select the entire method body
self condition ifTrue: [ ^ 0 ] ifFalse: [ ^ 1 ] - Extract method using the
(R) Extract method and occurrencesoption with selectorfoo
This will create =>
myMethod
self foo
foo
self condition
ifTrue: [ ^ 0 ]
ifFalse: [ ^ 1 ]
Which is incorrect because now myMethod returns self instead of 0 or 1
Tx :)
We should check if this is the refactoring or the transformation.
it's the refactoring 100% sure