<br><br><div class="gmail_quote">On Tue, Aug 25, 2009 at 2:16 PM, rdmerrio <span dir="ltr">&lt;<a href="mailto:rdmerrio@gmail.com">rdmerrio@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have defined a method, i.e.,<br>
<br>
someMethod<br>
   anInstVariable := anotherInstVariable1 + anotherInstVariable2.<br>
<br>
I would like to intercept the acceptance of this method by the browser and programatically determine what instance variables this method is using so that I can grab these names for other processing tasks.<br>
<br>
Additionally, I would really like to be able to determine what instance variables are being assigned to, for instance, anInstVariable in this case and which ones are the &quot;independent&quot; instance variables, anotherInstVariable1 and anotherInstVariable2 in this case.<br>

<br>
How can I do this?<br>
</blockquote><div><br>Why? What are you trying to achieve? You&#39;re talking about some pretty intrusive techniques. Unless you&#39;re developing a code analyser of some sort, you probably should be looking at a better way of doing what you&#39;re doing.<br>
<br>To capture the acceptance of a method (assuming you mean the action that happens when you press alt+s), you insert a bit of code into PluggableTextMorph&gt;&gt;accept.<br><br>To determine which instance variables are being assigned to, you&#39;ll need to somehow look at the bytecodes. They&#39;re not too hard to analyse, but it can be a bit of work. Alternatively, maybe the refactory browser can help, or maybe you can look at the intermediate code that the compiler generates.<br>
<br>The bytecodes are described here: <a href="http://burks.bton.ac.uk/burks/language/smaltalk/goldberg/blueb003.htm">http://burks.bton.ac.uk/burks/language/smaltalk/goldberg/blueb003.htm</a>. They&#39;re in the &quot;Blue book chapter 28&quot; if you need to Google it. You&#39;ll want the &quot;store&quot; bytecodes.<br>
</div></div><br>To see real bytecodes, either inspect &quot;Morph&gt;&gt;#basicInitialize&quot; to see a CompiledMethod, or use the &quot;byteCodes&quot; view in a Browser (hidden behind the &quot;source&quot; button).<br>
<br>Gulik.<br clear="all"><br>-- <br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a><br>