[Pharo-dev] Instrumenting field accesses with Opal?

Alexandre Bergel alexandre.bergel at me.com
Wed Nov 13 13:53:16 EST 2013


Thanks for discussing this issue. This is really interesting!

Alexandre


On Nov 13, 2013, at 12:02 PM, Camille Teruel <camille.teruel at gmail.com> wrote:

> 
> On 13 nov. 2013, at 15:18, Andrei Chis <chisvasileandrei at gmail.com> wrote:
> 
>> 
>> 
>> 
>> YourClass methods do: [ :method |
>> 	method ast 
>> 		forAllNodes: [ :node | node isVariable and: [ node isInstance ] ]
>> 		putAfter: [ RFMetalink expression: 'Transcript crShow: ''iv accessed''' ];
>> 		installWrapper ].
>> 
>> 
>> 
>> I tried this code but it fails in the latest version of Reflectivity :)
> 
> Neither in old ones, my mistake :)
> 
>> First "RFMetalink class(Object)>>doesNotUnderstand: #expression:"
> 
> Yes it's #fromExpression:
> 
>> then "A variable node on left side of assignment doesn''t accept metalinks"
> 
> Indeed
> For iv assignment, you should put metalinks on the assignment node.
> So it should be something like that:
> 
> YourClass methods do: [ :method |
> 	method ast 
> 		forAllNodes: [ :node | node isVariable and: [node isRead and: [ node isInstance ] ] ]
> 		putAfter: [ RFMetalink fromExpression: 'Transcript crShow: ''iv read''' ];
> 		forAllNodes: [ :node | node isAssignment and: [ node variable isInstance ] ]
> 		putAfter: [ RFMetalink fromExpression: 'Transcript crShow: ''iv written''' ];
> 		installWrapper ]
> 	
> 
>>  
>>> 		
>>> Alexandre
>>> -- 
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







More information about the Pharo-dev mailing list