[Pharo5] new feature: #sourceNodeExecuted on Context

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

[Pharo5] new feature: #sourceNodeExecuted on Context

Marcus Denker-4
Hi,

I added a method that returns the sub-tree of the AST that was executed by this context.
(e.g. the message send node of the message that was send that is the reason why we
are now executing thisContext).

e.g.

testSourceNodeExecuted
    | sourceNode |
    
    sourceNode := thisContext sender sender sourceNodeExecuted.
    self assert: sourceNode selector = #performTest.

AST caching guarantees that this is a true subtree of the method’s AST.

Marcus

Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] new feature: #sourceNodeExecuted on Context

stepharo
Nice :)
I hope you put this example as comment.


Le 31/8/15 08:37, Marcus Denker a écrit :
Hi,

I added a method that returns the sub-tree of the AST that was executed by this context.
(e.g. the message send node of the message that was send that is the reason why we
are now executing thisContext).

e.g.

testSourceNodeExecuted
    | sourceNode |
    
    sourceNode := thisContext sender sender sourceNodeExecuted.
    self assert: sourceNode selector = #performTest.

AST caching guarantees that this is a true subtree of the method’s AST.

Marcus


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] new feature: #sourceNodeExecuted on Context

Guillermo Polito

Does it also work with Block contexts and optimized ones?

Le 31 août 2015 08:45, "stepharo" <[hidden email]> a écrit :
Nice :)
I hope you put this example as comment.


Le 31/8/15 08:37, Marcus Denker a écrit :
Hi,

I added a method that returns the sub-tree of the AST that was executed by this context.
(e.g. the message send node of the message that was send that is the reason why we
are now executing thisContext).

e.g.

testSourceNodeExecuted
    | sourceNode |
    
    sourceNode := thisContext sender sender sourceNodeExecuted.
    self assert: sourceNode selector = #performTest.

AST caching guarantees that this is a true subtree of the method’s AST.

Marcus


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo5] new feature: #sourceNodeExecuted on Context

Marcus Denker-4

On 31 Aug 2015, at 09:00, Guillermo Polito <[hidden email]> wrote:

Does it also work with Block contexts and optimized ones?


Yes, I think so. But we should add tests.

It uses the same mechanism that manages highlighting in the debugger.

Le 31 août 2015 08:45, "stepharo" <[hidden email]> a écrit :
Nice :)
I hope you put this example as comment.


Le 31/8/15 08:37, Marcus Denker a écrit :
Hi,

I added a method that returns the sub-tree of the AST that was executed by this context.
(e.g. the message send node of the message that was send that is the reason why we
are now executing thisContext).

e.g.

testSourceNodeExecuted
    | sourceNode |
    
    sourceNode := thisContext sender sender sourceNodeExecuted.
    self assert: sourceNode selector = #performTest.

AST caching guarantees that this is a true subtree of the method’s AST.

Marcus