may be defining a method 
        aMethodReference actualClass lookupSelector: aMethodReference selector
on methodReference would laready help

Stef

On Jun 22, 2010, at 8:10 AM, laurent laffont wrote:

> Any hacker to start a code kata  here ? :)
> 
> Laurent 
> 
> On Fri, Jun 18, 2010 at 6:33 PM, laurent laffont <[email protected]> 
> wrote:
> Hi,
> 
> I have this method in AutotestFinder, I don't like it, someone has better 
> code ?
> 
> AutotestFinder>>allSendersOf: aCompiledMethod
>      "Returns all senders as a collection of CompiledMethod"
>       | methodReferences senders |
>       methodReferences := (SystemNavigation default allSendersOf: 
> aCompiledMethod selector).
>       senders := methodReferences collect: 
>                                       [:aMethodReference | 
>                                        aMethodReference actualClass
>                                                       lookupSelector: 
> aMethodReference selector].
>       ^ senders select: [:sender| sender isNil not]. "Why senders contains 
> nil sometimes ?"
> 
> What it does:
> 
> AutotestFinder new allSendersOf:  (ProfStef lookupSelector: #go) 
> 
> answers:
> 
> an OrderedCollection((ProfStef>>#go "a CompiledMethod(10485760)") 
> (ProtoObject>>#initialize "a CompiledMethod(326631424)") (ProfStef class>>#go 
> "a CompiledMethod(49807360)") (ProfStef class>>#initialize "a 
> CompiledMethod(1060634624)") (ProfStefBrowser class>>#menuCommandOn: "a 
> CompiledMethod(340262912)") 
> (ProfStefTestGo>>#testGoOpenSmalltalkSyntaxTutorial "a 
> CompiledMethod(249823232)"))
> 
> Cheers,
> 
> Laurent Laffont
> 
> http://pharocasts.blogspot.com/
> http://magaloma.blogspot.com/
> 
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to