Uniformized statement traversal for mapping, name generation, enqueueing

Uses a generic traverse<Fun>(statement, statement_node, fun).