Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Find methods which refer to string, symbol, or method

0 views
Skip to first unread message

Bob Jarvis

unread,
Dec 10, 2009, 7:46:18 PM12/10/09
to
I'm digging around in the image to try and figure this out but haven't
find the correct method invocation yet and I'm hoping someone might be
able to help shortcut this process. What I'm trying to do is to find
all methods (either within the entire system or, preferably, just
within a single class) which refer to a given string, symbol, or
method. I've found the #references family of methods in
SmalltalkSystem but have not had luck figuring out how to get them to
give back something resembling what I want.

Any/all help appreciated.

Thanks,
Bob

Christopher J. Demers

unread,
Dec 11, 2009, 12:16:22 AM12/11/09
to
...

Perhaps this work for what you need:

"This should handle symbols and methods."
Collection whichMethodsReferTo: #do:

"This will work for strings."
Collection whichMethodsContainSource: 'first'

I suspect that there may be a lot of different ways to do this.

Chris

Bob Jarvis

unread,
Dec 27, 2009, 10:08:44 PM12/27/09
to
On Dec 11, 12:16 am, "Christopher J. Demers"

<cdemersn...@mitchellscientific.com> wrote:
> Perhaps this work for what you need:
>
> Chris

Sorry I didn't respond earlier. Thanks for the suggestions. If you
pull down a new copy of my Burning River Goodies and look in the
RuleBasedLogic package you'll see how I ended up solving the problem.

In short, what I've got is a BlockClosure and I needed to determine if
it referred to a method or string. As it turned out I could use
BlockClosure>>method to find my way back to the method which defined
the block, then use the method's #refersToLiteral: and #sendsSelector:
methods to figure out if the method or literal was used in the
defining method.

Thanks,
Bob

0 new messages