Visiting Nodes

Stefan Marr java at stefan-marr.de
Sat May 2 15:05:05 UTC 2015


Hi Guido:

> On 02 May 2015, at 15:31, Guido Chari <charig at gmail.com> wrote:
> 
> @Stefan Thanks, sure it helps.
> So summarizing, my use case would be that i need a
> different visit method implementation for each kind of node.

I don’t think you’ll actually need what you described. The visitor I mentioned calls SOMNode.replaceWithIndependentCopyForInlining(), which is a polymorphic method implemented by all relevant nodes.

See:

https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/Inliner.java#L77
https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/nodes/SOMNode.java#L38
and for instance: https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/nodes/LocalVariableNode.java#L174

Best regards
Stefan

-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list