Cost me a day to realize that my code wasn't actually bugged, it was just that i :?-printed the node tree instead of :#?-printing it, causing me to see
instead of the full
ROOT_NODE@0..41
BLOCK_STMTS_NODE@0..41
STMT_NODE@0..41
STMT_KIND_NODE@0..41
EXPR_NODE@0..41
IF_EXPR_NODE@0..41
...
I suggest changing the debug-print to output
when ROOT_NODE has children, instead.