how to get all the send to super?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get all the send to super?

stepharo
Hi

I would like to study the use of super.
Any idea how I can query them?

Stef

Reply | Threaded
Open this post in threaded view
|

Re: how to get all the send to super?

camille teruel

On 28 Jun 2015, at 17:25, stepharo <[hidden email]> wrote:

Hi
I would like to study the use of super.
Any idea how I can query them?

Hi Stef,

To get all methods that have a super send you can do:

superSenders := CompiledMethod allInstances select: #sendsToSuper

If you need more advanced search you can do it with RBParseTreeSearcher.
For exemple to get each super message node:

superSends := OrderedCollection new.
searcher := RBParseTreeSearcher new matches: 'super ``@msg: ``@args' do: [ :node :ans | superSends add: node ].
superSenders do: [ :each | searcher executeTree: each ast ].
superSends

Camille


Stef


Reply | Threaded
Open this post in threaded view
|

Re: how to get all the send to super?

Nicolai Hess
In reply to this post by stepharo


2015-06-28 17:25 GMT+02:00 stepharo <[hidden email]>:
Hi

I would like to study the use of super.
Any idea how I can query them?

Stef



| rule result |
    rule := CodeSearchingRule new
        matcher:
                (RBParseTreeSearcher new
                        matches: 'super' do: [ :node :answer | node ];
                        yourself);
        yourself.
    result := RBSmalllintChecker runRule: rule onEnvironment: RBBrowserEnvironment default.
    MessageBrowser browse: result result methods title:'super' autoSelect:'super'
Reply | Threaded
Open this post in threaded view
|

Re: how to get all the send to super?

stepharo
In reply to this post by camille teruel
Tx!

Stef

Le 28/6/15 17:40, Camille a écrit :

On 28 Jun 2015, at 17:25, stepharo <[hidden email]> wrote:

Hi
I would like to study the use of super.
Any idea how I can query them?

Hi Stef,

To get all methods that have a super send you can do:

superSenders := CompiledMethod allInstances select: #sendsToSuper

If you need more advanced search you can do it with RBParseTreeSearcher.
For exemple to get each super message node:

superSends := OrderedCollection new.
searcher := RBParseTreeSearcher new matches: 'super ``@msg: ``@args' do: [ :node :ans | superSends add: node ].
superSenders do: [ :each | searcher executeTree: each ast ].
superSends

Camille


Stef