Any hacker to start a code kata here ? :) Laurent On Fri, Jun 18, 2010 at 6:33 PM, laurent laffont <laurent.laffont@gmail.com>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/