LĂ­der,

you can do something like:

class := myCompiledMethod methodClass.
class instVarNames select: [ :varName |
    idx := class instVarIndexFor: varName.
    myCompiledMethod readsField: idx or: [ myCompiledMethod writesField:
idx ]
]

because #readsField: and #writesField: are index based.

You can also see as an example: Behavior>>#whichSelectorsAccess:  that is
var named based, but over all class selectors.

Guille

On Sun, May 6, 2012 at 10:38 AM, Carla F. Griggio
<[email protected]>wrote:

> Hi!
> I'm playing with some metaprogramming, and I'm stuck at trying to find out
> *which* instance variables are referred inside a method.
> I've found that a CompiledMethod understands hasInstVarRefs, but I don't
> recognize a method that could tell just me what I'm looking for.
>
> Any leads?
>
> Thanks!
> Carla.
>

Reply via email to