<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thanks Joel.</p>
<p>This is integrated and now at GitHub.</p>
<p>Cheers,</p>
<div class="moz-cite-prefix">On 2026-07-30 8:41 PM, Joel Camera via
Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKc5+ieyHPBjTeGJU491a_p45ifR+LH2PGEYr3Fd-ELCf3zk+A@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hello folks!<br>
<br>
Here's a small fix in Extract Method. The problem was that
Extract Method was looking for code using the optimized AST (<font
face="monospace">CompiledMethod>>#methodNode</font>)
instead of the non-optimized AST (<font face="monospace">CompiledMethod>>#notOptimizedMethodNode</font>) as
it should be.<br>
<br>
When visiting the optimized AST (using a visitor or
`#nodesDo:`), some nodes appear that don't exist in the
original source code and therefore have no valid source
ranges. This makes them unusable for refactorings.<br>
<br>
A concrete example: given the following method:<br>
<br>
<font face="monospace">m1<br>
self foo ifNil: [ ^1 ] ifNotNil: [ ^2 ]<br>
</font><br>
If you try to extract <font face="monospace">self</font><font
face="monospace"> foo</font>, the optimized AST transforms
the #<font face="monospace">ifNil:ifNotNil:</font> send into a
comparison node (<font face="monospace">self foo = nil</font>)
that doesn't exist in the actual source code and has no valid
source range. When the Extract Method tries to work with that
node, it breaks.<br>
<br>
The fix replaces the use of <font face="monospace">#methodNode</font> with
<font face="monospace">#notOptimizedMethodNode</font> so that
Extract Method always works on the AST that faithfully
represents what the developer wrote.<br>
<br>
Cheers</div>
<div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div><br>
</div>
<a href="https://10pines.com/"
style="font-family:Roboto,Helvetica,Arial,sans-serif;font-size:medium"
target="_blank" moz-do-not-send="true"><img width="108"
src="https://10pines.github.io/email-signature/10pines-firma@2x.png"
style="margin-bottom:0.5em" moz-do-not-send="true"></a>
<h1 style="margin:0px;font-size:14px"><font
color="#999999">Joel Cámera</font></h1>
<h2
style="color:rgb(100,100,100);margin:0px 0px 1em;font-size:14px">Agile
Software Development</h2>
<h1 style="margin:0px;font-size:14px"><font
style="font-weight:normal" color="#666666">
<p style="margin:0px;font-size:12px">Alem 896, Floor
6, Buenos Aires, Argentina</p>
<p style="margin:0px;font-size:12px">+54 9 011 6091
3125</p>
</font></h1>
</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis.st">www.cuis.st</a>
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich</pre>
</body>
</html>