Trans AST nodes implementation question

Monkey Forums/Monkey Programming/Trans AST nodes implementation question

ziggy(Posted 2014) [#1]
Does anyone here know if at any point, there's a way to determine which nodes in the compiler are being ignored (dead code removal) and which ones not? I mean, is there any stage on the compilation process where removed AST nodes can be listed?
I would love to use the background compiler to tell me which areas of source code are not being compiled and displaythem diferently on the editor. I've seen dead code removal is one of the things that confuses newcomers the most (in addition to target setup).

I don't want to ask Mark as I can imagine he'll be rather busy this days, so if anyone that has tweaked a bit more than me the trans tools can enlighten me a bit, I would be grateful.


Brucey(Posted 2014) [#2]
After semanting, all those which are not IsSemanted() may be presumed dead. There isn't a definitive list. You'd need to traverse class/module decls to find them - or keep your own list somewhere else, maybe?
There's also an UpdateLiveMethods (or something) which can resurrect dead methods where required.

Removal was a bit of a pain for my project, as I needed everything to be generated, which required changes in various places.


ziggy(Posted 2014) [#3]
Thanks! I supose traversing class/module decls as long as IsSemanted is reliable could do it.